
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>动画 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="notify.html" />
    
    
    <link rel="prev" href="canvas-paint.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">----安卓 UI----</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="view.html">
            
                <a href="view.html">
            
                    
                    自定义控件和measure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="canvas-paint.html">
            
                <a href="canvas-paint.html">
            
                    
                    draw和canvas，paint详解
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.4" data-path="anim.html">
            
                <a href="anim.html">
            
                    
                    动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="notify.html">
            
                <a href="notify.html">
            
                    
                    notify系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="loading.html">
            
                <a href="loading.html">
            
                    
                    loading系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="status-ui.html">
            
                <a href="status-ui.html">
            
                    
                    StatusUI系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="touch-scroll.html">
            
                <a href="touch-scroll.html">
            
                    
                    滑动
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="layout.html">
            
                <a href="layout.html">
            
                    
                    Layout
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="textview.html">
            
                <a href="textview.html">
            
                    
                    TextView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="drawable.html">
            
                <a href="drawable.html">
            
                    
                    Drawable
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="item-template.html">
            
                <a href="item-template.html">
            
                    
                    列表Adapter模板化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="recyclerview.html">
            
                <a href="recyclerview.html">
            
                    
                    RecyclerView全解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="design.html">
            
                <a href="design.html">
            
                    
                    MeterialDesign详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="component.html">
            
                <a href="component.html">
            
                    
                    AyoComponent基础库--Activity和Fragment
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="systembartint.html">
            
                <a href="systembartint.html">
            
                    
                    SystembarTint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="permission-ask.html">
            
                <a href="permission-ask.html">
            
                    
                    权限控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="keyboard.html">
            
                <a href="keyboard.html">
            
                    
                    小键盘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="notification.html">
            
                <a href="notification.html">
            
                    
                    Notification
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----安卓 foundation----</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="mvp.html">
            
                <a href="mvp.html">
            
                    
                    MVP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="rxjava.html">
            
                <a href="rxjava.html">
            
                    
                    RxJava
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="lang.html">
            
                <a href="lang.html">
            
                    
                    常用工具类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="http.html">
            
                <a href="http.html">
            
                    
                    http
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="xml.html">
            
                <a href="xml.html">
            
                    
                    xml解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="json-reporter.html">
            
                <a href="json-reporter.html">
            
                    
                    Json解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="inject.html">
            
                <a href="inject.html">
            
                    
                    ButterKnife
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="thread.html">
            
                <a href="thread.html">
            
                    
                    安卓线程和looper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="process.html">
            
                <a href="process.html">
            
                    
                    多进程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="eventbus.html">
            
                <a href="eventbus.html">
            
                    
                    EventBus
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="db.html">
            
                <a href="db.html">
            
                    
                    数据库和ContentProvider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="job.html">
            
                <a href="job.html">
            
                    
                    定时任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="service.html">
            
                <a href="service.html">
            
                    
                    service
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="opt-mem.html">
            
                <a href="opt-mem.html">
            
                    
                    内存优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="opt-network.html">
            
                <a href="opt-network.html">
            
                    
                    网络优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="opt-anr.html">
            
                <a href="opt-anr.html">
            
                    
                    anr排查
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="opt-ui.html">
            
                <a href="opt-ui.html">
            
                    
                    UI卡顿优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.18" data-path="opt-launch.html">
            
                <a href="opt-launch.html">
            
                    
                    启动优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.19" data-path="opt-launch.html">
            
                <a href="opt-launch.html">
            
                    
                    混淆
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.20" data-path="hotfix.html">
            
                <a href="hotfix.html">
            
                    
                    热补丁混淆
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.21" data-path="aar.html">
            
                <a href="aar.html">
            
                    
                    aar相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.22" data-path="route.html">
            
                <a href="route.html">
            
                    
                    Route路由
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.23" data-path="modules.html">
            
                <a href="modules.html">
            
                    
                    分模块，组件化，插件化
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----Gradle----</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="gradle.html">
            
                <a href="gradle.html">
            
                    
                    gradle基本配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="gradle-plugin.html">
            
                <a href="gradle-plugin.html">
            
                    
                    gradle插件开发
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----工具----</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="repos.html">
            
                <a href="repos.html">
            
                    
                    优秀博客，开源项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="packs.html">
            
                <a href="packs.html">
            
                    
                    自动打包，多渠道打包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="gist.html">
            
                <a href="gist.html">
            
                    
                    代码片段和常见问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="stetho.html">
            
                <a href="stetho.html">
            
                    
                    stetho
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="fabric.html">
            
                <a href="fabric.html">
            
                    
                    fabric
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="app-update.html">
            
                <a href="app-update.html">
            
                    
                    自动升级
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="bugsnags.html">
            
                <a href="bugsnags.html">
            
                    
                    日志和崩溃统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="mail.html">
            
                <a href="mail.html">
            
                    
                    发邮件辅助接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="socail.html">
            
                <a href="socail.html">
            
                    
                    第三方登录和分享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="pay-alipay.html">
            
                <a href="pay-alipay.html">
            
                    
                    支付宝支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="pay-wx.html">
            
                <a href="pay-wx.html">
            
                    
                    微信支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="umeng.html">
            
                <a href="umeng.html">
            
                    
                    友盟统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="push-jpush.html">
            
                <a href="push-jpush.html">
            
                    
                    推送-极光
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="push-xiaomi.html">
            
                <a href="push-xiaomi.html">
            
                    
                    推送-小米
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >动画</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x52A8;&#x753B;">&#x52A8;&#x753B;</h1>
<h1 id="ayoanim">AyoAnim</h1>
<p>&#x7B14;&#x8BB0; for&#xFF1A;&#x5404;&#x79CD;&#x5B89;&#x5353;&#x52A8;&#x753B;&#xFF1B; &#x96C6;&#x5408; for&#xFF1A;&#x597D;&#x770B;&#x52A8;&#x753B;&#x6536;&#x96C6;&#x548C;&#x4EFF;&#x5199;&#xFF1B;&#x5E93; for&#xFF1A;&#x52A8;&#x753B;&#x4FBF;&#x5229;&#x5E93;</p>
<p>apk&#x4E0B;&#x8F7D;&#xFF1A;<br><img src="img/11d.png" alt=""></p>
<p>&#x6CA1;&#x6574;&#x5230;jcenter&#x4E0A;&#xFF0C;&#x6682;&#x65F6;&#x5C31;&#x7528;aar&#x5305;&#x5427;&#xFF0C;&#x4E5F;&#x633A;&#x7701;&#x52B2;&#xFF1A;<a href="https://github.com/cowthan/AyoAnim/blob/master/ayo-anim.aar?raw=true" target="_blank">&#x4E0B;&#x8F7D;&#x5730;&#x5740;</a><br>&#x4E0B;&#x8F7D;&#x4E0B;&#x6765;&#x6587;&#x4EF6;&#x540D;&#x662F;&#xFF1A;ayo-anim.aar&#xFF0C;&#x62F7;&#x5230;libs&#x76EE;&#x5F55;&#x91CC;<br>&#x7136;&#x540E;&#x5728;build.gradle&#x91CC;&#x5F15;&#x5165;&#xFF1A;</p>
<pre><code>repositories {
    flatDir {
        dirs &apos;libs&apos;
    }
}

compile(name:&apos;ayo-anim&apos;, ext:&apos;aar&apos;)
</code></pre><ul>
<li><p>&#x7279;&#x522B;&#x8BF4;&#x660E;&#xFF1A;</p>
<ul>
<li>&#x672C;&#x9879;&#x76EE;&#x65E2;&#x662F;&#x52A8;&#x753B;&#x7684;&#x5B66;&#x4E60;&#x7B14;&#x8BB0;&#x548C;demo</li>
<li>&#x4E5F;&#x662F;&#x6536;&#x96C6;&#x4E86;&#x4E00;&#x4E9B;&#x597D;&#x770B;&#x7684;&#x597D;&#x7528;&#x7684;&#x597D;&#x73A9;&#x7684;&#x52A8;&#x753B;&#x6548;&#x679C;</li>
<li>&#x6700;&#x4E3B;&#x8981;&#x7684;&#xFF0C;&#x5C31;&#x662F;&#x4E00;&#x4E2A;&#x901A;&#x7528;&#x52A8;&#x753B;&#x5E93;&#xFF0C;&#x672C;&#x6765;&#x4E4B;&#x524D;&#x4E00;&#x76F4;&#x7528;daimajia&#x7684;ease&#x548C;AndroidViewAnimation&#xFF0C;&#x4F46;&#x53D1;&#x73B0;hujiaweibujidao&#x7684;yava&#x548C;wava&#x4EE3;&#x7801;&#x66F4;&#x7B80;&#x6D01;</li>
<li>hujiawei ease&#xFF1A;<a href="https://github.com/hujiaweibujidao/yava" target="_blank">https://github.com/hujiaweibujidao/yava</a></li>
<li>hujiawei anim&#xFF1A;<a href="https://github.com/hujiaweibujidao/wava" target="_blank">https://github.com/hujiaweibujidao/wava</a></li>
<li>&#x4EE3;&#x7801;&#x5BB6; ease&#xFF1A;<a href="https://github.com/daimajia/AnimationEasingFunctions" target="_blank">https://github.com/daimajia/AnimationEasingFunctions</a></li>
<li>&#x4EE3;&#x7801;&#x5BB6; anim&#xFF1A;<a href="https://github.com/daimajia/AndroidViewAnimations" target="_blank">https://github.com/daimajia/AndroidViewAnimations</a></li>
<li>&#x6CE8;&#x610F;&#xFF1A;hujiawei&#x7684;&#x4EE3;&#x7801;&#x662F;&#x4EE3;&#x7801;&#x5BB6;&#x7684;&#x884D;&#x751F;&#xFF0C;&#x662F;&#x6539;&#x8FDB;&#xFF0C;&#x800C;&#x4E0D;&#x662F;&#x518D;&#x9020;&#x7684;&#x8F6E;&#x5B50;</li>
<li>&#x50CF;Flyco&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x7EC4;&#x63A7;&#x4EF6;&#x5E93;&#xFF0C;&#x633A;&#x597D;&#x7528;&#xFF0C;&#x4F46;&#x52A8;&#x753B;&#x7279;&#x6548;&#x786E;&#x5B9E;&#x57FA;&#x4E8E;&#x4ED6;&#x4EEC;&#x81EA;&#x5DF1;&#x7684;&#x4E00;&#x4E2A;&#x5E93;&#xFF0C;&#x592A;&#x4E0D;&#x7EDF;&#x4E00;&#x4E86;&#xFF0C;&#x8FD9;&#x79CD;&#x60C5;&#x51B5;&#x4EE5;&#x540E;&#x8981;&#x907F;&#x514D;&#xFF0C;&#x8C01;&#x7528;&#x8C01;&#x81EA;&#x5DF1;&#x907F;&#x514D;</li>
<li>hujiawei&#x8FD9;&#x4E2A;&#x600E;&#x4E48;&#x90FD;&#x597D;&#xFF0C;&#x5C31;&#x662F;&#x540D;&#x5B57;&#x4E0D;&#x8BB2;&#x7A76;&#xFF0C;&#x5176;&#x5B9E;&#x7ED9;&#x5F00;&#x6E90;&#x9879;&#x76EE;&#x8D77;&#x540D;&#x5B57;&#xFF0C;&#x662F;&#x5F88;&#x91CD;&#x8981;&#x7684;</li>
<li>&#x53E6;&#x5916;&#x6CE8;&#x610F;&#xFF1A;nineold&#x90FD;&#x5C06;&#x88AB;&#x5254;&#x9664;&#xFF0C;&#x4E0D;&#x518D;&#x8003;&#x8651;</li>
</ul>
</li>
<li><p>&#x5173;&#x4E8E;animator&#x5E93;</p>
<ul>
<li>&#x5728;ayo-animate&#x91CC;</li>
<li>ease&#x5305;&#x4E0B;&#x662F;hujiawei&#x7684;ease&#x5E93;&#xFF0C;&#x53EA;&#x4E0D;&#x8FC7;&#x6211;&#x6539;&#x4E86;&#x4E00;&#x4E0B;</li>
<li>&#x4E3A;&#x4EC0;&#x4E48;&#x6539;&#xFF0C;&#x4E3A;&#x4E86;&#x548C;YoYo&#x7ED3;&#x6784;&#x4E00;&#x6837;&#xFF0C;&#x4E00;&#x7EC4;&#x5B50;&#x7C7B;&#x4EE3;&#x8868;&#x6548;&#x679C;&#xFF0C;&#x4E00;&#x4E2A;&#x679A;&#x4E3E;&#x6574;&#x5408;</li>
</ul>
</li>
</ul>
<h2 id="1-&#x52A8;&#x753B;&#x57FA;&#x672C;&#x6982;&#x5FF5;">1 &#x52A8;&#x753B;&#x57FA;&#x672C;&#x6982;&#x5FF5;</h2>
<p>&#x8FD9;&#x91CC;&#x6211;&#x4EEC;&#x4ECE;ValueAnimator&#x51FA;&#x53D1;&#xFF0C;&#x6765;&#x8BF4;&#x8BF4;TypeEvaluator&#x548C;TimeInterpolator</p>
<p>&#x9996;&#x5148;&#x8981;&#x660E;&#x767D;&#xFF0C;&#x52A8;&#x753B;&#x5C31;&#x662F;&#x7EC4;&#x4EF6;&#x7684;&#x67D0;&#x4E2A;&#x5C5E;&#x6027;&#x4ECE;&#x4E00;&#x4E2A;&#x503C;&#x5230;&#x53E6;&#x4E00;&#x4E2A;&#x503C;&#x7684;&#x53D8;&#x5316;&#x8FC7;&#x7A0B;&#xFF0C;&#x5728;&#x53D8;&#x5316;&#x7684;&#x6301;&#x7EED;&#x65F6;&#x95F4;&#x5185;&#xFF0C;&#x5C5E;&#x6027;&#x503C;&#x4EA7;&#x751F;&#x4E00;&#x7CFB;&#x5217;&#x7684;&#x8FDE;&#x7EED;&#x53D8;&#x5316;&#xFF0C;<br>&#x5C06;&#x8FD9;&#x4E9B;&#x5C5E;&#x6027;&#x503C;&#x4F5C;&#x7528;&#x4E8E;&#x7EC4;&#x4EF6;&#x4E0A;&#xFF0C;&#x5C31;&#x770B;&#x5230;&#x4E86;&#x52A8;&#x753B;&#x6548;&#x679C;    </p>
<p>ValueAnimator&#x51B3;&#x5B9A;&#x4E86;&#xFF1A;&#x6BCF;&#x4E00;&#x5E27;&#x5728;&#x54EA;&#x91CC;&#x53D6;&#xFF0C;&#x53D6;&#x591A;&#x5C11;&#x5E27;<br>TimeInterpolator&#xFF1A;&#x63D2;&#x503C;&#x5668;&#x7684;&#x8F93;&#x5165;&#x662F;&#x65F6;&#x95F4;&#x53D8;&#x5316;&#x7387;&#xFF0C;&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x65F6;&#x95F4;&#xFF0C;&#x8F93;&#x51FA;&#x7684;&#x662F;&#x6839;&#x636E;&#x65F6;&#x95F4;&#x53D8;&#x5316;&#x7387;&#x5F97;&#x5230;&#x7684;&#x5C5E;&#x6027;&#x503C;&#x53D8;&#x5316;&#x7387;<br>&#x6240;&#x4EE5;&#x5982;&#x679C;&#x4F7F;&#x7528;LinearInterpolator&#xFF0C;&#x65F6;&#x95F4;&#x53D8;&#x5316;&#x7387;&#x548C;&#x5C5E;&#x6027;&#x503C;&#x53D8;&#x5316;&#x7387;&#x5C31;&#x662F;&#x7EBF;&#x6027;&#x5173;&#x7CFB;&#xFF0C;&#x76F8;&#x5F53;&#x4E8E;&#x8DF3;&#x8FC7;&#x4E86;Interpolator&#x8BA1;&#x7B97;&#x8FC7;&#x7A0B;<br>TypeEvaluator&#xFF1A;&#x4F30;&#x503C;&#x5668;&#x662F;&#x6839;&#x636E;&#x5C5E;&#x6027;&#x503C;&#x7684;&#x53D8;&#x5316;&#x7387;&#x8BA1;&#x7B97;&#x771F;&#x6B63;&#x7684;&#x5C5E;&#x6027;&#x503C;&#xFF0C;&#x8FD9;&#x53D6;&#x51B3;&#x4E8E;&#x5C5E;&#x6027;&#x503C;&#x7684;&#x7C7B;&#x578B;&#xFF0C;int&#xFF0C;float&#xFF0C;color&#x7B49;<br>&#x9ED8;&#x8BA4;&#x7684;IntEvaluator,FloatEvaluator&#xFF0C;&#x662F;&#x6700;&#x5178;&#x578B;&#x7684;&#x884C;&#x4E3A;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x8BA4;&#x4E3A;&#x8FD9;&#x79CD;&#x884C;&#x4E3A;&#x76F8;&#x5F53;&#x4E8E;&#x8DF3;&#x8FC7;&#x4E86;Evaluate&#x8FC7;&#x7A0B;  </p>
<h3 id="1-timeinterpolator&#x548C;typeevaluator">1 TimeInterpolator&#x548C;TypeEvaluator</h3>
<p>&#x5148;&#x6765;&#x8BF4;&#x8BF4;&#x63D2;&#x503C;&#x5668;&#x7684;&#x57FA;&#x672C;&#x7528;&#x6CD5;&#xFF0C;&#x6CE8;&#x610F;,&#x4E0B;&#x9762;&#x4EE3;&#x7801;&#x4E2D;&#x7684;&#x4E24;&#x4E2A;&#x52A8;&#x753B;&#x6548;&#x679C;&#x662F;&#x4E00;&#x6837;&#x7684;</p>
<pre><code class="lang-java">ValueAnimator animator1 = <span class="hljs-keyword">new</span> ValueAnimator();
animator1.setFloatValues(<span class="hljs-number">0.0f</span>, <span class="hljs-number">1.0f</span>);
animator1.setDuration(<span class="hljs-number">1000</span>);
animator1.setInterpolator(<span class="hljs-keyword">new</span> LinearInterpolator());<span class="hljs-comment">//&#x4F20;&#x5165;null&#x4E5F;&#x662F;LinearInterpolator</span>
animator1.setEvaluator(<span class="hljs-keyword">new</span> TypeEvaluator() {
    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> Object <span class="hljs-title">evaluate</span><span class="hljs-params">(<span class="hljs-keyword">float</span> fraction, Object startValue, Object endValue)</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-number">100</span> * fraction;
    }
});
animator1.addUpdateListener(<span class="hljs-keyword">new</span> ValueAnimator.AnimatorUpdateListener() {
    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationUpdate</span><span class="hljs-params">(ValueAnimator animation)</span> </span>{
        Log.e(<span class="hljs-string">&quot;demo 1&quot;</span>, <span class="hljs-string">&quot;&quot;</span> + animation.getAnimatedValue());
    }
});

ValueAnimator animator2 = <span class="hljs-keyword">new</span> ValueAnimator();
animator2.setFloatValues(<span class="hljs-number">0.0f</span>, <span class="hljs-number">1.0f</span>);
animator2.setDuration(<span class="hljs-number">1000</span>);
animator2.setInterpolator(<span class="hljs-keyword">new</span> Interpolator() {
    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">float</span> <span class="hljs-title">getInterpolation</span><span class="hljs-params">(<span class="hljs-keyword">float</span> input)</span> </span>{
        <span class="hljs-keyword">return</span> <span class="hljs-number">100</span> * input;
    }
});
animator2.setEvaluator(<span class="hljs-keyword">new</span> TypeEvaluator() {
    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> Object <span class="hljs-title">evaluate</span><span class="hljs-params">(<span class="hljs-keyword">float</span> fraction, Object startValue, Object endValue)</span> </span>{
        <span class="hljs-keyword">return</span> fraction;
    }
});
animator2.addUpdateListener(<span class="hljs-keyword">new</span> ValueAnimator.AnimatorUpdateListener() {
    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationUpdate</span><span class="hljs-params">(ValueAnimator animation)</span> </span>{
        Log.e(<span class="hljs-string">&quot;demo 2&quot;</span>, <span class="hljs-string">&quot;&quot;</span> + animation.getAnimatedValue());
    }
});

animator1.start();
animator2.start();
</code></pre>
<p>&#x5B89;&#x5353;&#x5185;&#x7F6E;&#x7684;Evaluator</p>
<pre><code class="lang-java">
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">FloatEvaluator</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">TypeEvaluator</span> </span>{  
    <span class="hljs-function"><span class="hljs-keyword">public</span> Object <span class="hljs-title">evaluate</span><span class="hljs-params">(<span class="hljs-keyword">float</span> fraction, Object startValue, Object endValue)</span> </span>{  
        <span class="hljs-keyword">float</span> startFloat = ((Number) startValue).floatValue();  
        <span class="hljs-keyword">return</span> startFloat + fraction * (((Number) endValue).floatValue() - startFloat);  
    }  
}  

&#x8FD8;&#x6709;&#x4E2A;IntEvaluator IntArrayEvalulator
&#x8FD8;&#x6709;&#x4E2A;FloatArrayEvaluator
</code></pre>
<p>int&#xFF0C;float&#x7684;Evaluator&#x8FD8;&#x597D;&#x7406;&#x89E3;&#xFF0C;&#x8FD8;&#x6709;&#x4E2A;ObjectEvaluator&#xFF0C;&#x5BF9;&#x8C61;&#x7684;&#x503C;&#x600E;&#x4E48;&#x8FC7;&#x6E21;&#x5462;&#xFF0C;&#x4F8B;&#x5982;Point&#x7684;&#x8FC7;&#x6E21;<br>&#x7406;&#x89E3;&#x4E86;&#x8FD9;&#x4E2A;&#x6709;&#x52A9;&#x4E8E;&#x540E;&#x9762;&#x7406;&#x89E3;Path&#x52A8;&#x753B;&#xFF0C;&#x56E0;&#x4E3A;&#x52A8;&#x753B;&#x6240;&#x52A8;&#x7684;&#x662F;&#x5728;Path&#x4E0A;&#x7684;&#x4E0B;&#x4E00;&#x5E27;&#x4F4D;&#x7F6E;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Point</span> </span>{  

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">float</span> x;  

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">float</span> y;  

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-title">Point</span><span class="hljs-params">(<span class="hljs-keyword">float</span> x, <span class="hljs-keyword">float</span> y)</span> </span>{  
        <span class="hljs-keyword">this</span>.x = x;  
        <span class="hljs-keyword">this</span>.y = y;  
    }  

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">float</span> <span class="hljs-title">getX</span><span class="hljs-params">()</span> </span>{  
        <span class="hljs-keyword">return</span> x;  
    }  

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">float</span> <span class="hljs-title">getY</span><span class="hljs-params">()</span> </span>{  
        <span class="hljs-keyword">return</span> y;  
    }  

}  

<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">PointEvaluator</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">TypeEvaluator</span></span>{  

    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> Object <span class="hljs-title">evaluate</span><span class="hljs-params">(<span class="hljs-keyword">float</span> fraction, Object startValue, Object endValue)</span> </span>{  
        Point startPoint = (Point) startValue;  
        Point endPoint = (Point) endValue;  
        <span class="hljs-keyword">float</span> x = startPoint.getX() + fraction * (endPoint.getX() - startPoint.getX());  
        <span class="hljs-keyword">float</span> y = startPoint.getY() + fraction * (endPoint.getY() - startPoint.getY());  
        Point point = <span class="hljs-keyword">new</span> Point(x, y);  
        <span class="hljs-keyword">return</span> point;  
    }  

}  

<span class="hljs-comment">//&#x5E94;&#x7528;Point&#xFF1A;&#x8FD9;&#x4E2A;&#x53EA;&#x662F;&#x5E73;&#x79FB;</span>
<span class="hljs-comment">//&#x5982;&#x679C;&#x4E24;&#x70B9;&#x4E4B;&#x95F4;&#x662F;&#x4E00;&#x6BB5;&#x66F2;&#x7EBF;&#xFF0C;&#x9053;&#x7406;&#x4E5F;&#x4E00;&#x6837;&#xFF0C;&#x4E0D;&#x8FC7;&#x9700;&#x8981;&#x5176;&#x4ED6;&#x5957;&#x8DEF;&#x4E86;</span>
Point point1 = <span class="hljs-keyword">new</span> Point(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>);  
Point point2 = <span class="hljs-keyword">new</span> Point(<span class="hljs-number">300</span>, <span class="hljs-number">300</span>);  
ValueAnimator anim = ValueAnimator.ofObject(<span class="hljs-keyword">new</span> PointEvaluator(), point1, point2);  
anim.setDuration(<span class="hljs-number">5000</span>);  
anim.start();
</code></pre>
<p>Color&#xFF0C;&#x4E5F;&#x5C31;&#x662F;Argb&#x7684;&#x4F30;&#x503C;&#x5668;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">ColorEvaluator</span> <span class="hljs-keyword">implements</span> <span class="hljs-title">TypeEvaluator</span> </span>{  

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> mCurrentRed = -<span class="hljs-number">1</span>;  

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> mCurrentGreen = -<span class="hljs-number">1</span>;  

    <span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> mCurrentBlue = -<span class="hljs-number">1</span>;  

    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> Object <span class="hljs-title">evaluate</span><span class="hljs-params">(<span class="hljs-keyword">float</span> fraction, Object startValue, Object endValue)</span> </span>{  
        String startColor = (String) startValue;  
        String endColor = (String) endValue;  
        <span class="hljs-keyword">int</span> startRed = Integer.parseInt(startColor.substring(<span class="hljs-number">1</span>, <span class="hljs-number">3</span>), <span class="hljs-number">16</span>);  
        <span class="hljs-keyword">int</span> startGreen = Integer.parseInt(startColor.substring(<span class="hljs-number">3</span>, <span class="hljs-number">5</span>), <span class="hljs-number">16</span>);  
        <span class="hljs-keyword">int</span> startBlue = Integer.parseInt(startColor.substring(<span class="hljs-number">5</span>, <span class="hljs-number">7</span>), <span class="hljs-number">16</span>);  
        <span class="hljs-keyword">int</span> endRed = Integer.parseInt(endColor.substring(<span class="hljs-number">1</span>, <span class="hljs-number">3</span>), <span class="hljs-number">16</span>);  
        <span class="hljs-keyword">int</span> endGreen = Integer.parseInt(endColor.substring(<span class="hljs-number">3</span>, <span class="hljs-number">5</span>), <span class="hljs-number">16</span>);  
        <span class="hljs-keyword">int</span> endBlue = Integer.parseInt(endColor.substring(<span class="hljs-number">5</span>, <span class="hljs-number">7</span>), <span class="hljs-number">16</span>);  
        <span class="hljs-comment">// &#x521D;&#x59CB;&#x5316;&#x989C;&#x8272;&#x7684;&#x503C;  </span>
        <span class="hljs-keyword">if</span> (mCurrentRed == -<span class="hljs-number">1</span>) {  
            mCurrentRed = startRed;  
        }  
        <span class="hljs-keyword">if</span> (mCurrentGreen == -<span class="hljs-number">1</span>) {  
            mCurrentGreen = startGreen;  
        }  
        <span class="hljs-keyword">if</span> (mCurrentBlue == -<span class="hljs-number">1</span>) {  
            mCurrentBlue = startBlue;  
        }  
        <span class="hljs-comment">// &#x8BA1;&#x7B97;&#x521D;&#x59CB;&#x989C;&#x8272;&#x548C;&#x7ED3;&#x675F;&#x989C;&#x8272;&#x4E4B;&#x95F4;&#x7684;&#x5DEE;&#x503C;  </span>
        <span class="hljs-keyword">int</span> redDiff = Math.abs(startRed - endRed);  
        <span class="hljs-keyword">int</span> greenDiff = Math.abs(startGreen - endGreen);  
        <span class="hljs-keyword">int</span> blueDiff = Math.abs(startBlue - endBlue);  
        <span class="hljs-keyword">int</span> colorDiff = redDiff + greenDiff + blueDiff;  
        <span class="hljs-keyword">if</span> (mCurrentRed != endRed) {  
            mCurrentRed = getCurrentColor(startRed, endRed, colorDiff, <span class="hljs-number">0</span>,  
                    fraction);  
        } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (mCurrentGreen != endGreen) {  
            mCurrentGreen = getCurrentColor(startGreen, endGreen, colorDiff,  
                    redDiff, fraction);  
        } <span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> (mCurrentBlue != endBlue) {  
            mCurrentBlue = getCurrentColor(startBlue, endBlue, colorDiff,  
                    redDiff + greenDiff, fraction);  
        }  
        <span class="hljs-comment">// &#x5C06;&#x8BA1;&#x7B97;&#x51FA;&#x7684;&#x5F53;&#x524D;&#x989C;&#x8272;&#x7684;&#x503C;&#x7EC4;&#x88C5;&#x8FD4;&#x56DE;  </span>
        String currentColor = <span class="hljs-string">&quot;#&quot;</span> + getHexString(mCurrentRed)  
                + getHexString(mCurrentGreen) + getHexString(mCurrentBlue);  
        <span class="hljs-keyword">return</span> currentColor;  
    }  

    <span class="hljs-comment">/** 
     * &#x6839;&#x636E;fraction&#x503C;&#x6765;&#x8BA1;&#x7B97;&#x5F53;&#x524D;&#x7684;&#x989C;&#x8272;&#x3002; 
     */</span>  
    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">int</span> <span class="hljs-title">getCurrentColor</span><span class="hljs-params">(<span class="hljs-keyword">int</span> startColor, <span class="hljs-keyword">int</span> endColor, <span class="hljs-keyword">int</span> colorDiff,  
            <span class="hljs-keyword">int</span> offset, <span class="hljs-keyword">float</span> fraction)</span> </span>{  
        <span class="hljs-keyword">int</span> currentColor;  
        <span class="hljs-keyword">if</span> (startColor &gt; endColor) {  
            currentColor = (<span class="hljs-keyword">int</span>) (startColor - (fraction * colorDiff - offset));  
            <span class="hljs-keyword">if</span> (currentColor &lt; endColor) {  
                currentColor = endColor;  
            }  
        } <span class="hljs-keyword">else</span> {  
            currentColor = (<span class="hljs-keyword">int</span>) (startColor + (fraction * colorDiff - offset));  
            <span class="hljs-keyword">if</span> (currentColor &gt; endColor) {  
                currentColor = endColor;  
            }  
        }  
        <span class="hljs-keyword">return</span> currentColor;  
    }  

    <span class="hljs-comment">/** 
     * &#x5C06;10&#x8FDB;&#x5236;&#x989C;&#x8272;&#x503C;&#x8F6C;&#x6362;&#x6210;16&#x8FDB;&#x5236;&#x3002; 
     */</span>  
    <span class="hljs-function"><span class="hljs-keyword">private</span> String <span class="hljs-title">getHexString</span><span class="hljs-params">(<span class="hljs-keyword">int</span> value)</span> </span>{  
        String hexString = Integer.toHexString(value);  
        <span class="hljs-keyword">if</span> (hexString.length() == <span class="hljs-number">1</span>) {  
            hexString = <span class="hljs-string">&quot;0&quot;</span> + hexString;  
        }  
        <span class="hljs-keyword">return</span> hexString;  
    }  

}  

<span class="hljs-comment">///&#x4F7F;&#x7528;</span>
ObjectAnimator anim = ObjectAnimator.ofObject(myAnimView, <span class="hljs-string">&quot;color&quot;</span>, <span class="hljs-keyword">new</span> ColorEvaluator(),   
    <span class="hljs-string">&quot;#0000FF&quot;</span>, <span class="hljs-string">&quot;#FF0000&quot;</span>);  
anim.setDuration(<span class="hljs-number">5000</span>);  
anim.start();
</code></pre>
<ul>
<li>&#x603B;&#x7ED3;&#xFF1A;  <ul>
<li>&#x63D2;&#x503C;&#x5668;&#x6839;&#x636E;&#x65F6;&#x95F4;&#x6D41;&#x901D;&#xFF0C;&#x8BA1;&#x7B97;&#x51FA;&#x52A8;&#x753B;&#x6D41;&#x901D;fraction&#xFF0C;&#x4F8B;&#x5982;duration&#x662F;10&#x79D2;&#xFF0C;&#x65F6;&#x95F4;&#x8FC7;&#x4E86;5&#x79D2;&#xFF0C;&#x4F46;fraction&#x662F;0.2&#xFF0C;&#x8868;&#x793A;&#x524D;&#x4E94;&#x79D2;&#x662F;&#x6162;&#x901F;&#x8FD0;&#x884C;&#x7684;&#xFF0C;&#x800C;&#x540E;5&#x79D2;&#xFF0C;&#x9700;&#x8981;&#x8D70;&#x5B8C;0.8&#xFF0C;&#x6240;&#x4EE5;&#x662F;&#x52A0;&#x901F;&#x7684;<ul>
<li>&#x6240;&#x4EE5;&#x63D2;&#x503C;&#x5668;&#x7BA1;&#x7684;&#x5E94;&#x8BE5;&#x662F;&#x901F;&#x5EA6;&#xFF0C;&#x4F46;fraction&#x4E5F;&#x53EF;&#x4EE5;&#x662F;&#x8D1F;&#x503C;&#xFF0C;&#x5373;&#x5728;&#x521D;&#x59CB;&#x503C;&#x4E4B;&#x524D;&#xFF0C;&#x6216;&#x8005;&#x7ED3;&#x675F;&#x503C;&#x4E4B;&#x540E;&#xFF0C;&#x4EE5;&#x6B64;&#x53EF;&#x4EE5;&#x4EA7;&#x751F;&#x6643;&#x52A8;&#x6548;&#x679C;</li>
<li>&#x4F60;&#x5E94;&#x8BE5;&#x95EE;&#x63D2;&#x503C;&#x5668;&#xFF0C;&#x65F6;&#x95F4;&#x5DF2;&#x8FC7;5&#x79D2;&#xFF0C;&#x52A8;&#x753B;&#x7684;&#x8FDB;&#x5EA6;&#x662F;&#x591A;&#x5C11;&#x4E86;&#xFF1F;</li>
</ul>
</li>
<li>&#x4F30;&#x503C;&#x5668;&#x6839;&#x636E;&#x52A8;&#x753B;&#x6D41;&#x901D;&#xFF0C;&#x8BA1;&#x7B97;&#x51FA;&#x8FD9;&#x4E00;&#x5E27;&#x7684;&#x5C5E;&#x6027;&#x503C;&#xFF0C;&#x5C5E;&#x6027;&#x53EF;&#x80FD;&#x662F;int&#xFF0C;float&#x8FD9;&#x79CD;&#x503C;&#x7C7B;&#x578B;&#xFF0C;&#x4E5F;&#x53EF;&#x80FD;&#x662F;Color&#xFF0C;&#x4E5F;&#x53EF;&#x80FD;Point&#x548C;Path&#x7684;&#x5173;&#x7CFB;&#x8BA1;&#x7B97;<ul>
<li>&#x6240;&#x4EE5;&#x4F30;&#x503C;&#x5668;&#x7BA1;&#x7684;&#x662F;&#x8FD9;&#x4E00;&#x5E27;&#x7684;&#x5C5E;&#x6027;&#x503C;&#xFF0C;&#x4F60;&#x5E94;&#x8BE5;&#x95EE;&#x4F30;&#x503C;&#x5668;&#xFF0C;&#x52A8;&#x753B;&#x8FDB;&#x5EA6;&#x5DF2;&#x7ECF;&#x8FC7;&#x4E86;0.2&#x4E86;&#xFF08;fraction&#xFF09;&#xFF0C;&#x8FD9;&#x65F6;&#x7684;&#x5C5E;&#x6027;&#x503C;&#x5E94;&#x8BE5;&#x662F;&#x591A;&#x5C11;</li>
</ul>
</li>
<li>&#x6240;&#x4EE5;&#x5982;&#x679C;&#x662F;Linear&#x7684;&#x63D2;&#x503C;&#x5668;&#xFF0C;&#x65F6;&#x95F4;&#x6D41;&#x901D;&#x5373;&#x52A8;&#x753B;&#x8FDB;&#x5EA6;&#xFF0C;&#x5219;&#x6240;&#x6709;&#x5904;&#x7406;&#x8FDB;&#x5EA6;&#x7684;&#x903B;&#x8F91;&#xFF0C;&#x548C;&#x8BA1;&#x7B97;&#x5C5E;&#x6027;&#x503C;&#x7684;&#x903B;&#x8F91;&#xFF0C;&#x90FD;&#x53EF;&#x4EE5;&#x4EA4;&#x7ED9;&#x4F30;&#x503C;&#x5668;&#x6765;&#x7B97;</li>
</ul>
</li>
</ul>
<p>&#x57FA;&#x4E8E;&#x4E0A;&#x9762;&#x7684;&#x793A;&#x4F8B;&#xFF0C;&#x5176;&#x5B9E;daimajia&#x7684;&#x5F00;&#x6E90;&#x9879;&#x76EE;AnimationEasingFunctions&#xFF0C;&#x4E5F;&#x662F;&#x57FA;&#x4E8E;Evaluator&#x7684;<br>&#x800C;hujiawei&#x7684;ease&#x5E93;&#xFF0C;&#x540C;&#x65F6;&#x652F;&#x6301;&#x63D2;&#x503C;&#x7528;&#x6CD5;&#x548C;&#x4F30;&#x503C;&#x7528;&#x6CD5;</p>
<h2 id="2-ease&#x5E93;&#x7528;&#x6CD5;">2 ease&#x5E93;&#x7528;&#x6CD5;</h2>
<p>ease&#x5E93;&#x662F;&#x53D6;&#x81EA;&#xFF1A;
<a href="https://github.com/hujiaweibujidao/yava" target="_blank">https://github.com/hujiaweibujidao/yava</a></p>
<pre><code class="lang-java">
<span class="hljs-comment">///&#x679A;&#x4E3E;&#x7528;&#x6CD5;&#xFF1A;as Evaluator</span>
ObjectAnimator animator1 = <span class="hljs-keyword">new</span> ObjectAnimator();
animator1.setTarget(textView1);
animator1.setPropertyName(<span class="hljs-string">&quot;translationY&quot;</span>);
animator1.setFloatValues(<span class="hljs-number">0f</span>, -<span class="hljs-number">100f</span>);
animator1.setDuration(<span class="hljs-number">1000</span>);

animator1.setInterpolator(<span class="hljs-keyword">new</span> LinearInterpolator());
animator1.setEvaluator(EasingFunction.BOUNCE_OUT.getEasingFunction()); <span class="hljs-comment">//use `EasingFunction.BOUNCE_OUT` as `TypeEvaluator`</span>
animator1.start();


<span class="hljs-comment">///&#x679A;&#x4E3E;&#x7528;&#x6CD5;&#xFF1A;as Interpolator</span>
ObjectAnimator animator2 = <span class="hljs-keyword">new</span> ObjectAnimator();
animator2.setTarget(textView2);
animator2.setPropertyName(<span class="hljs-string">&quot;translationY&quot;</span>);
animator2.setFloatValues(<span class="hljs-number">0f</span>, -<span class="hljs-number">100f</span>);
animator2.setDuration(<span class="hljs-number">1000</span>);

animator2.setInterpolator(EasingFunction.BOUNCE_OUT.getEasingFunction()); <span class="hljs-comment">//use `EasingFunction.BOUNCE_OUT` as `Interpolator`</span>
animator2.setEvaluator(<span class="hljs-keyword">new</span> FloatEvaluator());

animator2.start();

<span class="hljs-comment">///&#x81EA;&#x5B9A;&#x4E49;ease&#x51FD;&#x6570;&#xFF08;&#x4E5F;&#x652F;&#x6301;&#x63D2;&#x503C;&#x7528;&#x6CD5;&#x548C;&#x4F30;&#x503C;&#x7528;&#x6CD5;&#xFF09;</span>
ObjectAnimator animator1 = <span class="hljs-keyword">new</span> ObjectAnimator();
animator1.setTarget(textView1);
animator1.setPropertyName(<span class="hljs-string">&quot;translationY&quot;</span>);
animator1.setFloatValues(<span class="hljs-number">0f</span>, -<span class="hljs-number">100f</span>);
animator1.setDuration(<span class="hljs-number">1000</span>);

animator1.setInterpolator(<span class="hljs-keyword">new</span> LinearInterpolator());
animator1.setEvaluator(EasingFunction.with(<span class="hljs-keyword">new</span> IFunction() { <span class="hljs-comment">//customized TypeEvaluator</span>
    <span class="hljs-meta">@Override</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">float</span> <span class="hljs-title">getValue</span><span class="hljs-params">(<span class="hljs-keyword">float</span> input)</span> </span>{
        <span class="hljs-keyword">return</span> input * <span class="hljs-number">2</span> + <span class="hljs-number">3</span>;
    }
}));

animator1.start();

<span class="hljs-comment">///&#x5982;&#x4F55;&#x652F;&#x6301;ColorEvaluator&#x6216;&#x8005;ARGBEvaluator</span>
</code></pre>
<p>&#x5B89;&#x5353;&#x5185;&#x7F6E;&#x7684;&#x51E0;&#x4E2A;&#x63D2;&#x503C;&#x5668;&#xFF1A;</p>
<pre><code class="lang-java">
TimeInterpolator   --&gt; Interpolator --&gt; BaseInterpolator

LinearInterpolator
AccelerateInterpolator&#xFF1A;&#x5F00;&#x59CB;&#x6162;&#xFF0C;&#x540E;&#x9762;&#x5FEB;
DecelerateInterpolator
AccelerateDecelerateInterpolator&#xFF1A;&#x5F00;&#x59CB;&#x6162;&#xFF0C;&#x7ED3;&#x675F;&#x6162;&#xFF0C;&#x4E2D;&#x95F4;&#x5FEB;
AnticipateInterpolator
OvershootInterpolator
AnticipateOvershootInterpolator
BounceInterpolator
CycleInterpolator

PathInterpolator
</code></pre>
<p>&#x5B89;&#x5353;&#x5185;&#x7F6E;&#x7684;&#x51E0;&#x4E2A;&#x4F30;&#x503C;&#x5668;&#xFF1A;</p>
<pre><code class="lang-java">TypeEvaluator

ArgbEvaluator
FloatEvaluator
FloatArrayEvaluator
IntEvaluator
IntArrayEvaluator
PointFEvaluator
RectEvaluator
</code></pre>
<h2 id="3-yoyo&#x5E93;&#x7528;&#x6CD5;&#xFF1A;&#x5C5E;&#x6027;&#x52A8;&#x753B;">3 YoYo&#x5E93;&#x7528;&#x6CD5;&#xFF1A;&#x5C5E;&#x6027;&#x52A8;&#x753B;</h2>
<pre><code class="lang-java">YoYoString rope =  YoYo.with(Techniques.FadeIn).duration(duration)
                .interpolate(Functions.Accelerate)
                .listen(<span class="hljs-keyword">new</span> AnimatorListenerAdapter() {
                    <span class="hljs-meta">@Override</span>
                    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationCancel</span><span class="hljs-params">(Animator animation)</span> </span>{
                        Toast.makeText(DemoYoyoActivity.<span class="hljs-keyword">this</span>, <span class="hljs-string">&quot;&#x53D6;&#x6D88;&#x4E86;&quot;</span>, Toast.LENGTH_SHORT).show();
                    }
                })
                .playOn(mTarget);

<span class="hljs-comment">//&#x505C;&#x6B62;&#x52A8;&#x753B;</span>
rope.stop();
</code></pre>
<h2 id="4-&#x5E27;&#x52A8;&#x753B;">4 &#x5E27;&#x52A8;&#x753B;</h2>
<p>&#x591A;&#x4E2A;&#x56FE;&#x7247;&#x914D;&#x5408;&#x5F62;&#x6210;&#x52A8;&#x753B;&#xFF0C;&#x7C7B;&#x4F3C;gif&#x56FE;&#xFF0C;&#x4F17;&#x6240;&#x5468;&#x77E5;&#x6BD4;&#x8F83;&#x8017;&#x8D39;&#x8D44;&#x6E90;&#xFF0C;&#x4F46;&#x6709;&#x65F6;&#x4E5F;&#x662F;&#x6700;&#x6709;&#x6548;&#x7684;</p>
<p>&#x8FD9;&#x91CC;&#x53EA;&#x8BF4;&#x8BF4;&#x7528;&#x6CD5;</p>
<pre><code>//&#x5728;res/drawable&#xFF0C;&#x521B;&#x5EFA;anim1.xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- 
    &#x6839;&#x6807;&#x7B7E;&#x4E3A;animation-list&#xFF0C;&#x5176;&#x4E2D;oneshot&#x4EE3;&#x8868;&#x7740;&#x662F;&#x5426;&#x53EA;&#x5C55;&#x793A;&#x4E00;&#x904D;&#xFF0C;&#x8BBE;&#x7F6E;&#x4E3A;false&#x4F1A;&#x4E0D;&#x505C;&#x7684;&#x5FAA;&#x73AF;&#x64AD;&#x653E;&#x52A8;&#x753B;
    &#x6839;&#x6807;&#x7B7E;&#x4E0B;&#xFF0C;&#x901A;&#x8FC7;item&#x6807;&#x7B7E;&#x5BF9;&#x52A8;&#x753B;&#x4E2D;&#x7684;&#x6BCF;&#x4E00;&#x4E2A;&#x56FE;&#x7247;&#x8FDB;&#x884C;&#x58F0;&#x660E;
    android:duration &#x8868;&#x793A;&#x5C55;&#x793A;&#x6240;&#x7528;&#x7684;&#x8BE5;&#x56FE;&#x7247;&#x7684;&#x65F6;&#x95F4;&#x957F;&#x5EA6;
 --&gt;
&lt;animation-list
  xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
  android:oneshot=&quot;true&quot;
  &gt;
      &lt;item android:drawable=&quot;@drawable/icon1&quot; android:duration=&quot;150&quot;&gt;&lt;/item&gt;
      &lt;item android:drawable=&quot;@drawable/icon2&quot; android:duration=&quot;150&quot;&gt;&lt;/item&gt;
      &lt;item android:drawable=&quot;@drawable/icon3&quot; android:duration=&quot;150&quot;&gt;&lt;/item&gt;
      &lt;item android:drawable=&quot;@drawable/icon4&quot; android:duration=&quot;150&quot;&gt;&lt;/item&gt;
      &lt;item android:drawable=&quot;@drawable/icon5&quot; android:duration=&quot;150&quot;&gt;&lt;/item&gt;
      &lt;item android:drawable=&quot;@drawable/icon6&quot; android:duration=&quot;150&quot;&gt;&lt;/item&gt;
&lt;/animation-list&gt;

&#x5C06;&#x5176;&#x4F5C;&#x4E3A;ImageView&#x7684;src&#x5C5E;&#x6027;&#xFF0C;&#x6216;&#x8005;&#x5176;&#x4ED6;&#x63A7;&#x4EF6;&#x7684;background&#x5C5E;&#x6027;
&lt;ImageView android:id=&quot;@+id/animationIV&quot;
    android:layout_width=&quot;wrap_content&quot;
    android:layout_height=&quot;wrap_content&quot;
    android:padding=&quot;5px&quot;
    android:src=&quot;@drawable/animation1&quot;/&gt;

Java&#x4EE3;&#x7801;
iv.setImageResource(R.drawable.animation1);
animationDrawable = (AnimationDrawable) animationIV.getDrawable();
animationDrawable.start();
</code></pre><h2 id="5-&#x8865;&#x95F4;&#x52A8;&#x753B;">5 &#x8865;&#x95F4;&#x52A8;&#x753B;</h2>
<ul>
<li>View&#x52A8;&#x753B;&#xFF1A;<ul>
<li>&#x5E73;&#x79FB;&#xFF1A;TranslateAnimation</li>
<li>&#x900F;&#x660E;&#x5EA6;&#xFF1A;AlphaAnimation</li>
<li>&#x65CB;&#x8F6C;&#xFF1A;RotateAnimation</li>
<li>&#x7F29;&#x653E;&#xFF1A;ScaleAnimation</li>
<li>&#x65E0;&#x8BBA;&#x5982;&#x4F55;&#x79FB;&#x52A8;&#x539F;View&#xFF0C;View&#x59CB;&#x7EC8;&#x5360;&#x636E;&#x539F;&#x5148;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x5728;&#x65B0;&#x4F4D;&#x7F6E;&#x70B9;&#x51FB;&#x4E5F;&#x4E0D;&#x4F1A;&#x89E6;&#x53D1;&#x70B9;&#x51FB;&#x4E8B;&#x4EF6;</li>
</ul>
</li>
</ul>
<h3 id="51-&#x5165;&#x95E8;">5.1 &#x5165;&#x95E8;</h3>
<p>&#x5728;Java&#x4EE3;&#x7801;&#x4E2D;&#x521B;&#x5EFA;&#x52A8;&#x753B;</p>
<pre><code class="lang-java">
<span class="hljs-comment">///-----------------&#x5E73;&#x79FB;</span>
TranslateAnimation(<span class="hljs-keyword">int</span> fromXType, <span class="hljs-keyword">float</span> fromXValue, <span class="hljs-keyword">int</span> toXType, <span class="hljs-keyword">float</span> toXValue,
            <span class="hljs-keyword">int</span> fromYType, <span class="hljs-keyword">float</span> fromYValue, <span class="hljs-keyword">int</span> toYType, <span class="hljs-keyword">float</span> toYValue)
fromXType    &#xFF1A;&#x5728;X&#x8F74;&#x4E0A;&#x52A8;&#x753B;&#x76F8;&#x5BF9;&#x4E8E;&#x8C01;&#x79FB;&#x52A8;&#xFF0C;&#x4E00;&#x822C;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;Animation.RELATIVE_TO_PARENT&#xFF0C;&#x6216;&#x8005;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x79FB;&#x52A8;Animation.RELATIVE_TO_SELF
fromXValue    &#xFF1A;&#x5728;X&#x8F74;&#x4E0A;&#x7684;&#x8D77;&#x59CB;&#x65F6;&#x7684;&#x79FB;&#x52A8;&#x8DDD;&#x79BB;&#xFF0C;&#x4E00;&#x822C;&#x4E3A;<span class="hljs-number">0f</span>&#xFF0C;&#x5373;&#x539F;&#x6765;&#x4F4D;&#x7F6E;
toXType        &#xFF1A;&#x5728;&#x7ED3;&#x675F;&#x65F6;X&#x8F74;&#x76F8;&#x5BF9;&#x4E8E;&#x8C01;&#x79FB;&#x52A8;&#xFF0C;&#x540C;fromXType
toXValue    &#xFF1A;&#x5728;&#x7ED3;&#x675F;&#x65F6;&#x52A8;&#x753B;X&#x8F74;&#x6240;&#x5904;&#x7684;&#x8DDD;&#x79BB;&#xFF0C;&#x82E5;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x79FB;&#x52A8;&#xFF0C;&#x4E00;&#x822C;&#x4E0D;&#x8D85;&#x591A;<span class="hljs-number">1.0f</span>&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x79FB;&#x52A8;&#x5230;&#x5C4F;&#x5E55;&#x5916;&#x9762;
fromYType    &#xFF1A;&#x5728;Y&#x8F74;&#x4E0A;&#x52A8;&#x753B;&#x76F8;&#x5BF9;&#x4E8E;&#x8C01;&#x79FB;&#x52A8;&#xFF0C;&#x4E00;&#x822C;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;Animation.RELATIVE_TO_PARENT&#xFF0C;&#x6216;&#x8005;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x79FB;&#x52A8;Animation.RELATIVE_TO_SELF
fromYValue    &#xFF1A;&#x5728;Y&#x8F74;&#x4E0A;&#x7684;&#x8D77;&#x59CB;&#x65F6;&#x7684;&#x79FB;&#x52A8;&#x8DDD;&#x79BB;&#xFF0C;&#x4E00;&#x822C;&#x4E3A;<span class="hljs-number">0f</span>&#xFF0C;&#x5373;&#x539F;&#x6765;&#x4F4D;&#x7F6E;
toYType        &#xFF1A;&#x5728;&#x7ED3;&#x675F;&#x65F6;Y&#x8F74;&#x76F8;&#x5BF9;&#x4E8E;&#x8C01;&#x79FB;&#x52A8;&#xFF0C;&#x540C;fromXType
toYValue    &#xFF1A;&#x5728;&#x7ED3;&#x675F;&#x65F6;&#x52A8;&#x753B;Y&#x8F74;&#x6240;&#x5904;&#x7684;&#x8DDD;&#x79BB;&#xFF0C;&#x82E5;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x79FB;&#x52A8;&#xFF0C;&#x4E00;&#x822C;&#x4E0D;&#x8D85;&#x591A;<span class="hljs-number">1.0f</span>&#xFF0C;&#x5426;&#x5219;&#x4F1A;&#x79FB;&#x52A8;&#x5230;&#x5C4F;&#x5E55;&#x5916;&#x9762;

<span class="hljs-comment">//&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#xFF0C;&#x5F80;&#x53F3;&#x4E0B;&#x89D2;45&#x5EA6;&#x79FB;&#x52A8;&#x7684;&#x793A;&#x4F8B;</span>
TranslateAnimation trans = <span class="hljs-keyword">new</span> TranslateAnimation(
        Animation.RELATIVE_TO_PARENT, <span class="hljs-number">0f</span>,    <span class="hljs-comment">// &#x8D77;&#x59CB;&#x65F6;X&#x8F74;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x79FB;&#x52A8;</span>
        Animation.RELATIVE_TO_PARENT, <span class="hljs-number">0.2f</span>,     <span class="hljs-comment">// &#x7ED3;&#x675F;&#x65F6;X&#x8F74;&#x4E5F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x79FB;&#x52A8;</span>
        Animation.RELATIVE_TO_PARENT, <span class="hljs-number">0</span>,    <span class="hljs-comment">// &#x8D77;&#x59CB;&#x65F6;Y&#x8F74;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x79FB;&#x52A8;</span>
        Animation.RELATIVE_TO_PARENT, <span class="hljs-number">0.2f</span>);    <span class="hljs-comment">// &#x7ED3;&#x675F;&#x65F6;Y&#x8F74;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x79FB;&#x52A8;</span>
trans.setDuration(<span class="hljs-number">2000</span>);
imageView.startAnimation(trans);

<span class="hljs-comment">///-----------------&#x900F;&#x660E;&#x5EA6;</span>
<span class="hljs-comment">//1.0&#x610F;&#x5473;&#x7740;&#x7740;&#x5B8C;&#x5168;&#x4E0D;&#x900F;&#x660E; 0.0&#x610F;&#x5473;&#x7740;&#x5B8C;&#x5168;&#x900F;&#x660E;</span>
AlphaAnimation aa = <span class="hljs-keyword">new</span> AlphaAnimation(<span class="hljs-number">1.0f</span>, <span class="hljs-number">0.0f</span>);
aa.setDuration(<span class="hljs-number">2000</span>); <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x52A8;&#x753B;&#x6267;&#x884C;&#x7684;&#x65F6;&#x95F4;</span>
aa.setRepeatCount(<span class="hljs-number">1</span>); <span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x91CD;&#x590D;&#x7684;&#x6B21;&#x6570;</span>
aa.setRepeatMode(Animation.REVERSE);<span class="hljs-comment">//&#x8BBE;&#x7F6E;&#x52A8;&#x753B;&#x6267;&#x884C;&#x7684;&#x6A21;&#x5F0F;</span>
<span class="hljs-comment">//imageView&#x5F00;&#x59CB;&#x6267;&#x884C;&#x52A8;&#x753B; </span>
imageView.startAnimation(aa);

<span class="hljs-comment">///-----------------&#x65CB;&#x8F6C;</span>
RotateAnimation(<span class="hljs-keyword">float</span> fromDegrees, <span class="hljs-keyword">float</span> toDegrees, <span class="hljs-keyword">int</span> pivotXType, <span class="hljs-keyword">float</span> pivotXValue,
        <span class="hljs-keyword">int</span> pivotYType, <span class="hljs-keyword">float</span> pivotYValue)
fromDegrees &#xFF1A; &#x4ECE;&#x54EA;&#x4E2A;&#x89D2;&#x5EA6;&#x5F00;&#x59CB;&#x65CB;&#x8F6C;&#xFF0C;&#x4E00;&#x822C;&#x4E3A;<span class="hljs-number">0</span>
toDegrees    &#xFF1A; &#x7ED3;&#x675F;&#x7684;&#x65F6;&#x5019;&#x89D2;&#x5EA6;&#x4E3A;&#x591A;&#x5C11;&#xFF0C;&#x5982;&#x8F6C;&#x4E00;&#x5708;&#x5219;&#x4E3A;<span class="hljs-number">360</span>
pivotXType    &#xFF1A; &#x5728;X&#x8F74;&#x4E0A;&#x52A8;&#x753B;&#x76F8;&#x5BF9;&#x4E8E;&#x8C01;&#x65CB;&#x8F6C;&#xFF0C;&#x4E00;&#x822C;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;Animation.RELATIVE_TO_PARENT&#xFF0C;&#x6216;&#x8005;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x65CB;&#x8F6C;Animation.RELATIVE_TO_SELF
pivotXValue    &#xFF1A; &#x5728;X&#x8F74;&#x4E0A;&#x52A8;&#x753B;&#x65CB;&#x8F6C;&#x7684;&#x4E2D;&#x5FC3;&#x70B9;
pivotYType    &#xFF1A; &#x5728;Y&#x8F74;&#x4E0A;&#x52A8;&#x753B;&#x76F8;&#x5BF9;&#x4E8E;&#x8C01;&#x65CB;&#x8F6C;&#xFF0C;&#x540C;pivotXType
pivotYValue    &#xFF1A; &#x5728;Y&#x8F74;&#x4E0A;&#x52A8;&#x753B;&#x65CB;&#x8F6C;&#x7684;&#x4E2D;&#x5FC3;&#x70B9;

<span class="hljs-comment">//&#x4EE5;imageView&#x7684;&#x4E2D;&#x5FC3;&#x70B9;&#x65CB;&#x8F6C;360&#x5EA6;&#x56DE;&#x5230;&#x539F;&#x70B9;</span>
RotateAnimation rotate = <span class="hljs-keyword">new</span> RotateAnimation(<span class="hljs-number">0</span>, <span class="hljs-number">360</span>, <span class="hljs-comment">// &#x4ECE;0&#x5EA6;&#x5F00;&#x59CB;&#x65CB;&#x8F6C;&#xFF0C;&#x5230;360&#x5EA6;&#x7ED3;&#x675F;</span>
        Animation.RELATIVE_TO_SELF, <span class="hljs-number">0.5f</span>,     <span class="hljs-comment">// X&#x8F74;&#x6307;&#x5B9A;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x8FD8;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x65CB;&#x8F6C;&#xFF0C;0.5f&#x5219;&#x662F;&#x4EE5;&#x81EA;&#x5DF1;&#x5BBD;&#x5EA6;&#x7684;&#x4E8C;&#x5206;&#x4E4B;&#x4E00;&#x4E3A;&#x65CB;&#x8F6C;&#x70B9;</span>
        Animation.RELATIVE_TO_SELF, <span class="hljs-number">0.5f</span>);    <span class="hljs-comment">// Y&#x8F74;&#x6307;&#x5B9A;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x8FD8;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x65CB;&#x8F6C;&#xFF0C;0.5f&#x5219;&#x662F;&#x4EE5;&#x81EA;&#x5DF1;&#x9AD8;&#x5EA6;&#x7684;&#x4E8C;&#x5206;&#x4E4B;&#x4E00;&#x4E3A;&#x65CB;&#x8F6C;&#x70B9;</span>
rotate.setDuration(<span class="hljs-number">2000</span>);
imageView.startAnimation(rotate);

<span class="hljs-comment">///-----------------&#x7F29;&#x653E;</span>
ScaleAnimation(<span class="hljs-keyword">float</span> fromX, <span class="hljs-keyword">float</span> toX, <span class="hljs-keyword">float</span> fromY, <span class="hljs-keyword">float</span> toY,
            <span class="hljs-keyword">int</span> pivotXType, <span class="hljs-keyword">float</span> pivotXValue, <span class="hljs-keyword">int</span> pivotYType, <span class="hljs-keyword">float</span> pivotYValue)
fromX    &#xFF1A; &#x52A8;&#x753B;&#x7684;X&#x8F74;&#x4ECE;&#x591A;&#x5927;&#x5F00;&#x59CB;&#x7F29;&#x653E;&#xFF0C;&#x4E00;&#x822C;&#x4E3A;<span class="hljs-number">1.0f</span>&#xFF0C;&#x5373;&#x52A8;&#x753B;&#x539F;&#x672C;&#x5927;&#x5C0F;&#x5F00;&#x59CB;&#x7F29;&#x653E;
toX        &#xFF1A; &#x52A8;&#x753B;&#x5728;X&#x8F74;&#x65B9;&#x5411;&#x4E0A;&#x8981;&#x7F29;&#x653E;&#x5230;&#x591A;&#x5927;&#xFF0C;&#x5982;&#x679C;&#x5C0F;&#x4E8E;<span class="hljs-number">1.0f</span>&#xFF0C;&#x5219;&#x52A8;&#x753B;&#x5728;X&#x8F74;&#x4E0A;&#x7684;&#x8DDD;&#x79BB;&#x4F1A;&#x53D8;&#x5C0F;&#xFF0C;&#x5927;&#x4E8E;<span class="hljs-number">1.0f</span>&#x4F1A;&#x653E;&#x5927;
fromY    &#xFF1A; &#x52A8;&#x753B;&#x7684;Y&#x8F74;&#x4ECE;&#x591A;&#x5927;&#x5F00;&#x59CB;&#x7F29;&#x653E;,&#x5176;&#x4ED6;&#x540C;fromX
toY        &#xFF1A; &#x52A8;&#x753B;&#x5728;Y&#x8F74;&#x65B9;&#x5411;&#x4E0A;&#x8981;&#x7F29;&#x653E;&#x5230;&#x591A;&#x5927;&#xFF0C;&#x5176;&#x4ED6;&#x540C;toX
pivotXType    &#xFF1A; X&#x8F74;&#x6307;&#x5B9A;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x8FD8;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x7F29;&#x653E;&#xFF0C;&#x4E00;&#x822C;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;Animation.RELATIVE_TO_PARENT&#xFF0C;&#x6216;&#x8005;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x7F29;&#x653E;Animation.RELATIVE_TO_SELF
pivotXValue    &#xFF1A; &#x6307;&#x5B9A;X&#x8F74;&#x65B9;&#x5411;&#x4E0A;&#x54EA;&#x4E2A;&#x4F4D;&#x7F6E;&#x4E3A;&#x4E2D;&#x5FC3;&#x7F29;&#x653E;
pivotYType    &#xFF1A; Y&#x8F74;&#x540C;pivotXType
pivotYValue    &#xFF1A; Y&#x8F74;&#x540C;pivotXValue

<span class="hljs-comment">//&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x4ECE;&#x4E2D;&#x5FC3;&#x70B9;&#x653E;&#x5927;</span>
ScaleAnimation scale = <span class="hljs-keyword">new</span> ScaleAnimation(<span class="hljs-number">1.0f</span>, <span class="hljs-number">2.0f</span>, <span class="hljs-number">1.0f</span>, <span class="hljs-number">2.0f</span>,     <span class="hljs-comment">// 1.0f&#x4EE3;&#x8868;&#x539F;&#x672C;&#x5927;&#x5C0F;&#xFF0C;2.0f&#x4EE3;&#x8868;&#x653E;&#x5927;&#x4E00;&#x500D;</span>
        Animation.RELATIVE_TO_SELF, <span class="hljs-number">0.5f</span>, <span class="hljs-comment">// X&#x8F74;&#x6307;&#x5B9A;&#x76F8;&#x5BF9;&#x4E8E;&#x81EA;&#x5DF1;&#x8FD8;&#x662F;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x653E;&#x5927;&#xFF0C;&#x7B2C;&#x4E8C;&#x4E2A;&#x5219;&#x662F;&#x4EE5;&#x54EA;&#x4E2A;&#x4F4D;&#x7F6E;&#x4E3A;X&#x8F74;&#x7684;&#x65CB;&#x8F6C;&#x70B9;&#xFF0C;&#x6B64;&#x5904;&#x4E3A;&#x4E2D;&#x5FC3;&#x70B9;&#x653E;&#x5927;</span>
        Animation.RELATIVE_TO_SELF, <span class="hljs-number">0.5f</span>);
scale.setDuration(<span class="hljs-number">2000</span>);
imageView.startAnimation(scale);
</code></pre>
<p>&#x5728;xml&#x4E2D;&#x521B;&#x5EFA;&#x52A8;&#x753B;</p>
<pre><code>//Java&#x4EE3;&#x7801;&#x52A0;&#x8F7D;xml&#x52A8;&#x753B;
Animation translate = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.translate);
//&#x5F00;&#x59CB;&#x52A8;&#x753B;
iv.startAnimation(translate);

//&#x5728;anim&#x76EE;&#x5F55;&#x4E0B;

&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;translate
    android:fromXDelta=&quot;0%p&quot;    // &#x8D77;&#x59CB;&#x4F4D;&#x7F6E;&#x4E3A;&#x539F;&#x6765;&#x7684;&#x4F4D;&#x7F6E;&#xFF0C;&#x540E;&#x9762;&#x5E26;P&#x4EE3;&#x8868;&#x76F8;&#x5BF9;&#x4E8E;&#x7236;&#x63A7;&#x4EF6;&#x79FB;&#x52A8;&#xFF0C;&#x5373;&#x4EE3;&#x7801;&#x5E03;&#x5C40;&#x4E2D;&#x7684;Animation.RELATIVE_TO_PARENT
    android:toXDelta=&quot;0%p&quot;
    android:fromYDelta=&quot;0%p&quot;
    android:toYDelta=&quot;20%p&quot;            
    android:fillAfter=&quot;true&quot;
    android:duration=&quot;2000&quot;
    xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;

&lt;/translate&gt;
</code></pre><p>&#x52A8;&#x753B;&#x96C6;&#x5408;</p>
<h3 id="52-&#x81EA;&#x5B9A;&#x4E49;&#x8865;&#x95F4;&#x52A8;&#x753B;">5.2 &#x81EA;&#x5B9A;&#x4E49;&#x8865;&#x95F4;&#x52A8;&#x753B;</h3>
<p>&#x4E3B;&#x8981;&#x662F;Matrix&#x548C;Camera&#x7684;&#x4F7F;&#x7528;&#xFF0C;&#x6240;&#x4EE5;&#x6709;&#x70B9;&#x9EBB;&#x70E6;&#xFF0C;&#x4E0B;&#x9762;&#x4EE5;ApiDemo&#x91CC;&#x7684;Rotate3D&#x4EE3;&#x7801;&#x4E3A;&#x4F8B;</p>
<pre><code>
import android.view.animation.Animation;
import android.view.animation.Transformation;
import android.graphics.Camera;
import android.graphics.Matrix;

/**
 * An animation that rotates the view on the Y axis between two specified angles.
 * This animation also adds a translation on the Z axis (depth) to improve the effect.
 */
public class Rotate3dAnimation extends Animation {
    private final float mFromDegrees;
    private final float mToDegrees;
    private final float mCenterX;
    private final float mCenterY;
    private final float mDepthZ;
    private final boolean mReverse;
    private Camera mCamera;

    /**
     * Creates a new 3D rotation on the Y axis. The rotation is defined by its
     * start angle and its end angle. Both angles are in degrees. The rotation
     * is performed around a center point on the 2D space, definied by a pair
     * of X and Y coordinates, called centerX and centerY. When the animation
     * starts, a translation on the Z axis (depth) is performed. The length
     * of the translation can be specified, as well as whether the translation
     * should be reversed in time.
     *
     * @param fromDegrees the start angle of the 3D rotation
     * @param toDegrees the end angle of the 3D rotation
     * @param centerX the X center of the 3D rotation
     * @param centerY the Y center of the 3D rotation
     * @param reverse true if the translation should be reversed, false otherwise
     */
    public Rotate3dAnimation(float fromDegrees, float toDegrees,
            float centerX, float centerY, float depthZ, boolean reverse) {
        mFromDegrees = fromDegrees;
        mToDegrees = toDegrees;
        mCenterX = centerX;
        mCenterY = centerY;
        mDepthZ = depthZ;
        mReverse = reverse;
    }

    @Override
    public void initialize(int width, int height, int parentWidth, int parentHeight) {
        super.initialize(width, height, parentWidth, parentHeight);
        mCamera = new Camera();
    }

    @Override
    protected void applyTransformation(float interpolatedTime, Transformation t) {
        final float fromDegrees = mFromDegrees;
        float degrees = fromDegrees + ((mToDegrees - fromDegrees) * interpolatedTime);

        final float centerX = mCenterX;
        final float centerY = mCenterY;
        final Camera camera = mCamera;

        final Matrix matrix = t.getMatrix();

        camera.save();
        if (mReverse) {
            camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime);
        } else {
            camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime));
        }
        camera.rotateY(degrees);
        camera.getMatrix(matrix);
        camera.restore();

        matrix.preTranslate(-centerX, -centerY);
        matrix.postTranslate(centerX, centerY);
    }
}
</code></pre><h2 id="6-&#x5C5E;&#x6027;&#x52A8;&#x753B;">6 &#x5C5E;&#x6027;&#x52A8;&#x753B;</h2>
<h3 id="61-&#x5C5E;&#x6027;&#x52A8;&#x753B;">6.1 &#x5C5E;&#x6027;&#x52A8;&#x753B;</h3>
<pre><code class="lang-java"><span class="hljs-comment">///&#x5E73;&#x79FB;</span>
<span class="hljs-comment">//&#x5148;&#x79FB;&#x52A8;&#x5230;10&#xFF0C;&#x7136;&#x540E;&#x7EE7;&#x7EED;&#x5411;&#x53F3;&#x79FB;&#x52A8;&#x5230;50&#xFF0C;&#x5728;&#x5411;&#x5DE6;&#x79FB;&#x52A8;&#x5230;20&#xFF0C;&#x6700;&#x540E;&#x79FB;&#x52A8;&#x5230;100&#x7684;&#x4F4D;&#x7F6E;</span>
ObjectAnimator oa = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;translationX&quot;</span>, <span class="hljs-number">10</span>, <span class="hljs-number">50</span>, <span class="hljs-number">20</span>, <span class="hljs-number">100</span>);
oa.setDuration(<span class="hljs-number">2000</span>);
oa.start(); <span class="hljs-comment">//&#x5F00;&#x59CB;&#x52A8;&#x753B;</span>

<span class="hljs-comment">///&#x65CB;&#x8F6C;</span>
ObjectAnimator oa = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;rotationX&quot;</span>, <span class="hljs-number">0</span>, <span class="hljs-number">180</span>, <span class="hljs-number">90</span>, <span class="hljs-number">360</span>);
oa.setDuration(<span class="hljs-number">2000</span>);
oa.start();

<span class="hljs-comment">///&#x900F;&#x660E;&#x5EA6;</span>
ObjectAnimator oa = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;alpha&quot;</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0.5f</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>,<span class="hljs-number">0</span>,<span class="hljs-number">1</span>);
oa.setDuration(<span class="hljs-number">2000</span>);
oa.start();

<span class="hljs-comment">///&#x7F29;&#x653E;</span>
ObjectAnimator oa = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;scaleY&quot;</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0.5f</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>,<span class="hljs-number">0</span>,<span class="hljs-number">1</span>);
oa.setDuration(<span class="hljs-number">2000</span>);
oa.start();

<span class="hljs-comment">///&#x52A8;&#x753B;&#x5E76;&#x884C;&#x6216;&#x8005;&#x4E32;&#x884C;</span>
AnimatorSet as = <span class="hljs-keyword">new</span> AnimatorSet();
ObjectAnimator oa = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;translationX&quot;</span>, <span class="hljs-number">10</span>, <span class="hljs-number">50</span>, <span class="hljs-number">20</span>, <span class="hljs-number">100</span>);
ObjectAnimator oa2 = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;scaleY&quot;</span>, <span class="hljs-number">0.1f</span>, <span class="hljs-number">2</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>);
ObjectAnimator oa3 = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;alpha&quot;</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0.5f</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>);
ObjectAnimator oa4 = ObjectAnimator.ofFloat(imageView, <span class="hljs-string">&quot;rotationY&quot;</span>, <span class="hljs-number">0</span>, <span class="hljs-number">180</span>, <span class="hljs-number">90</span>, <span class="hljs-number">360</span>);
as.setDuration(<span class="hljs-number">2000</span>);<span class="hljs-comment">//&#x6267;&#x884C;&#x52A8;&#x753B;&#x65F6;&#x957F;</span>
as.setTarget(iv);<span class="hljs-comment">//iv&#x6267;&#x884C;&#x52A8;&#x753B;</span>
<span class="hljs-comment">//&#x5F80;&#x96C6;&#x5408;&#x4E2D;&#x6DFB;&#x52A0;&#x52A8;&#x753B;</span>
<span class="hljs-comment">//&#x52A8;&#x753B;&#x9010;&#x4E2A;&#x6267;&#x884C;</span>
as.playSequentially(oa, oa2, oa3, oa4);
<span class="hljs-comment">//&#x52A8;&#x753B;&#x5168;&#x90E8;&#x4E00;&#x8D77;&#x6267;&#x884C;</span>
<span class="hljs-comment">//as.playTogether(oa, oa2, oa3, oa4);</span>
as.start();

<span class="hljs-comment">///&#x52A8;&#x753B;&#x7EC4;&#x5408;</span>
after(Animator anim)   &#x5C06;&#x73B0;&#x6709;&#x52A8;&#x753B;&#x63D2;&#x5165;&#x5230;&#x4F20;&#x5165;&#x7684;&#x52A8;&#x753B;&#x4E4B;&#x540E;&#x6267;&#x884C;
after(<span class="hljs-keyword">long</span> delay)   &#x5C06;&#x73B0;&#x6709;&#x52A8;&#x753B;&#x5EF6;&#x8FDF;&#x6307;&#x5B9A;&#x6BEB;&#x79D2;&#x540E;&#x6267;&#x884C;
before(Animator anim)   &#x5C06;&#x73B0;&#x6709;&#x52A8;&#x753B;&#x63D2;&#x5165;&#x5230;&#x4F20;&#x5165;&#x7684;&#x52A8;&#x753B;&#x4E4B;&#x524D;&#x6267;&#x884C;
with(Animator anim)   &#x5C06;&#x73B0;&#x6709;&#x52A8;&#x753B;&#x548C;&#x4F20;&#x5165;&#x7684;&#x52A8;&#x753B;&#x540C;&#x65F6;&#x6267;&#x884C;

ObjectAnimator moveIn = ObjectAnimator.ofFloat(textview, <span class="hljs-string">&quot;translationX&quot;</span>, -<span class="hljs-number">500f</span>, <span class="hljs-number">0f</span>);  
ObjectAnimator rotate = ObjectAnimator.ofFloat(textview, <span class="hljs-string">&quot;rotation&quot;</span>, <span class="hljs-number">0f</span>, <span class="hljs-number">360f</span>);  
ObjectAnimator fadeInOut = ObjectAnimator.ofFloat(textview, <span class="hljs-string">&quot;alpha&quot;</span>, <span class="hljs-number">1f</span>, <span class="hljs-number">0f</span>, <span class="hljs-number">1f</span>);  
AnimatorSet animSet = <span class="hljs-keyword">new</span> AnimatorSet();  
animSet.play(rotate).with(fadeInOut).after(moveIn);  
animSet.setDuration(<span class="hljs-number">5000</span>);  
animSet.start();  

<span class="hljs-comment">///&#x76D1;&#x542C;</span>
anim.addListener(<span class="hljs-keyword">new</span> AnimatorListener() {  
    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationStart</span><span class="hljs-params">(Animator animation)</span> </span>{  
    }  

    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationRepeat</span><span class="hljs-params">(Animator animation)</span> </span>{  
    }  

    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationEnd</span><span class="hljs-params">(Animator animation)</span> </span>{  
    }  

    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationCancel</span><span class="hljs-params">(Animator animation)</span> </span>{  
    }  
});  

anim.addListener(<span class="hljs-keyword">new</span> AnimatorListenerAdapter() {    <span class="hljs-comment">///&#x8FD9;&#x4E2A;&#x662F;&#x57FA;&#x7C7B;&#xFF0C;&#x5BF9;&#x6240;&#x6709;&#x65B9;&#x6CD5;&#x63D0;&#x4F9B;&#x4E86;&#x4E00;&#x4E2A;&#x7A7A;&#x5B9E;&#x73B0;&#xFF0C;&#x65B9;&#x4FBF;</span>
    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationEnd</span><span class="hljs-params">(Animator animation)</span> </span>{  
    }  
}); 

<span class="hljs-comment">///&#x53D6;&#x6D88;&#xFF0C;&#x6E05;&#x9664;&#x7B49;</span>
</code></pre>
<p>&#x5728;xml&#x91CC;&#x8BBE;&#x7F6E;&#x5C5E;&#x6027;&#x52A8;&#x753B;</p>
<pre><code class="lang-xml">//java&#x4EE3;&#x7801;&#x52A0;&#x8F7D;&#x52A8;&#x753B;
ObjectAnimator oa = (ObjectAnimator) AnimatorInflater.loadAnimator(this, R.animator.oanimator);
//&#x8BBE;&#x7F6E;&#x6267;&#x884C;&#x76EE;&#x6807;
oa.setTarget(iv);
oa.start();//&#x5F00;&#x59CB;&#x6267;&#x884C;

res/animator&#x4E0B;
<span class="php"><span class="hljs-meta">&lt;?</span>xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;utf-8&quot;</span><span class="hljs-meta">?&gt;</span></span>
<span class="hljs-tag">&lt;<span class="hljs-name">animator</span> <span class="hljs-attr">xmlns:android</span>=<span class="hljs-string">&quot;http://schemas.android.com/apk/res/android&quot;</span> &gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">objectAnimator</span> 
        <span class="hljs-attr">android:propertyName</span>=<span class="hljs-string">&quot;translationX&quot;</span>
        <span class="hljs-attr">android:duration</span>=<span class="hljs-string">&quot;2000&quot;</span>
        <span class="hljs-attr">android:valueFrom</span>=<span class="hljs-string">&quot;10&quot;</span>
        <span class="hljs-attr">android:valueTo</span>=<span class="hljs-string">&quot;100&quot;</span>
        &gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">objectAnimator</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">animator</span>&gt;</span>


<span class="php"><span class="hljs-meta">&lt;?</span>xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;utf-8&quot;</span><span class="hljs-meta">?&gt;</span></span>
<span class="hljs-tag">&lt;<span class="hljs-name">objectAnimator</span> <span class="hljs-attr">xmlns:android</span>=<span class="hljs-string">&quot;http://schemas.android.com/apk/res/android&quot;</span>  
    <span class="hljs-attr">android:valueFrom</span>=<span class="hljs-string">&quot;1&quot;</span>  
    <span class="hljs-attr">android:valueTo</span>=<span class="hljs-string">&quot;0&quot;</span>  
    <span class="hljs-attr">android:valueType</span>=<span class="hljs-string">&quot;floatType&quot;</span>  
    <span class="hljs-attr">android:propertyName</span>=<span class="hljs-string">&quot;alpha&quot;</span>/&gt;</span>  


<span class="php"><span class="hljs-meta">&lt;?</span>xml version=<span class="hljs-string">&quot;1.0&quot;</span> encoding=<span class="hljs-string">&quot;utf-8&quot;</span><span class="hljs-meta">?&gt;</span></span>
<span class="hljs-tag">&lt;<span class="hljs-name">set</span> <span class="hljs-attr">xmlns:android</span>=<span class="hljs-string">&quot;http://schemas.android.com/apk/res/android&quot;</span>  
    <span class="hljs-attr">android:ordering</span>=<span class="hljs-string">&quot;sequentially&quot;</span> &gt;</span>  

    <span class="hljs-tag">&lt;<span class="hljs-name">objectAnimator</span>  
        <span class="hljs-attr">android:duration</span>=<span class="hljs-string">&quot;2000&quot;</span>  
        <span class="hljs-attr">android:propertyName</span>=<span class="hljs-string">&quot;translationX&quot;</span>  
        <span class="hljs-attr">android:valueFrom</span>=<span class="hljs-string">&quot;-500&quot;</span>  
        <span class="hljs-attr">android:valueTo</span>=<span class="hljs-string">&quot;0&quot;</span>  
        <span class="hljs-attr">android:valueType</span>=<span class="hljs-string">&quot;floatType&quot;</span> &gt;</span>  
    <span class="hljs-tag">&lt;/<span class="hljs-name">objectAnimator</span>&gt;</span>  

    <span class="hljs-tag">&lt;<span class="hljs-name">set</span> <span class="hljs-attr">android:ordering</span>=<span class="hljs-string">&quot;together&quot;</span> &gt;</span>  
        <span class="hljs-tag">&lt;<span class="hljs-name">objectAnimator</span>  
            <span class="hljs-attr">android:duration</span>=<span class="hljs-string">&quot;3000&quot;</span>  
            <span class="hljs-attr">android:propertyName</span>=<span class="hljs-string">&quot;rotation&quot;</span>  
            <span class="hljs-attr">android:valueFrom</span>=<span class="hljs-string">&quot;0&quot;</span>  
            <span class="hljs-attr">android:valueTo</span>=<span class="hljs-string">&quot;360&quot;</span>  
            <span class="hljs-attr">android:valueType</span>=<span class="hljs-string">&quot;floatType&quot;</span> &gt;</span>  
        <span class="hljs-tag">&lt;/<span class="hljs-name">objectAnimator</span>&gt;</span>  

        <span class="hljs-tag">&lt;<span class="hljs-name">set</span> <span class="hljs-attr">android:ordering</span>=<span class="hljs-string">&quot;sequentially&quot;</span> &gt;</span>  
            <span class="hljs-tag">&lt;<span class="hljs-name">objectAnimator</span>  
                <span class="hljs-attr">android:duration</span>=<span class="hljs-string">&quot;1500&quot;</span>  
                <span class="hljs-attr">android:propertyName</span>=<span class="hljs-string">&quot;alpha&quot;</span>  
                <span class="hljs-attr">android:valueFrom</span>=<span class="hljs-string">&quot;1&quot;</span>  
                <span class="hljs-attr">android:valueTo</span>=<span class="hljs-string">&quot;0&quot;</span>  
                <span class="hljs-attr">android:valueType</span>=<span class="hljs-string">&quot;floatType&quot;</span> &gt;</span>  
            <span class="hljs-tag">&lt;/<span class="hljs-name">objectAnimator</span>&gt;</span>  
            <span class="hljs-tag">&lt;<span class="hljs-name">objectAnimator</span>  
                <span class="hljs-attr">android:duration</span>=<span class="hljs-string">&quot;1500&quot;</span>  
                <span class="hljs-attr">android:propertyName</span>=<span class="hljs-string">&quot;alpha&quot;</span>  
                <span class="hljs-attr">android:valueFrom</span>=<span class="hljs-string">&quot;0&quot;</span>  
                <span class="hljs-attr">android:valueTo</span>=<span class="hljs-string">&quot;1&quot;</span>  
                <span class="hljs-attr">android:valueType</span>=<span class="hljs-string">&quot;floatType&quot;</span> &gt;</span>  
            <span class="hljs-tag">&lt;/<span class="hljs-name">objectAnimator</span>&gt;</span>  
        <span class="hljs-tag">&lt;/<span class="hljs-name">set</span>&gt;</span>  
    <span class="hljs-tag">&lt;/<span class="hljs-name">set</span>&gt;</span>  

<span class="hljs-tag">&lt;/<span class="hljs-name">set</span>&gt;</span>
</code></pre>
<p>ValueAnimator&#x7684;&#x7528;&#x6CD5;&#xFF1A;</p>
<pre><code class="lang-java">ValueAnimator anim = ValueAnimator.ofFloat(<span class="hljs-number">0f</span>, <span class="hljs-number">1f</span>);  
anim.setDuration(<span class="hljs-number">300</span>);  
anim.addUpdateListener(<span class="hljs-keyword">new</span> ValueAnimator.AnimatorUpdateListener() {  
    <span class="hljs-meta">@Override</span>  
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onAnimationUpdate</span><span class="hljs-params">(ValueAnimator animation)</span> </span>{  
        <span class="hljs-keyword">float</span> currentValue = (<span class="hljs-keyword">float</span>) animation.getAnimatedValue();  
        Log.d(<span class="hljs-string">&quot;TAG&quot;</span>, <span class="hljs-string">&quot;cuurent value is &quot;</span> + currentValue);  <span class="hljs-comment">///0&#x5230;1</span>
    }  
});  
anim.start();  

&#x4ECE;<span class="hljs-number">0</span>&#x5230;<span class="hljs-number">100</span>&#x5E73;&#x6ED1;&#x8FC7;&#x6E21;
&lt;animator xmlns:android=<span class="hljs-string">&quot;http://schemas.android.com/apk/res/android&quot;</span>  
    android:valueFrom=<span class="hljs-string">&quot;0&quot;</span>  
    android:valueTo=<span class="hljs-string">&quot;100&quot;</span>  
    android:valueType=<span class="hljs-string">&quot;intType&quot;</span>/&gt;
</code></pre>
<p>&#x5E38;&#x7528;&#x5C5E;&#x6027;&#xFF1A;</p>
<pre><code class="lang-java">setStartDelay()&#xFF1A;&#x8BBE;&#x7F6E;&#x52A8;&#x753B;&#x5EF6;&#x8FDF;&#x64AD;&#x653E;&#x7684;&#x65F6;&#x95F4;
setRepeatCount()&#xFF1A;&#x52A8;&#x753B;&#x5FAA;&#x73AF;&#x64AD;&#x653E;&#x7684;&#x6B21;&#x6570;
setRepeatMode()&#xFF1A;&#x5FAA;&#x73AF;&#x64AD;&#x653E;&#x7684;&#x6A21;&#x5F0F;&#xFF0C;RESTART&#x548C;REVERSE&#xFF0C;&#x91CD;&#x65B0;&#x64AD;&#x653E;&#x548C;&#x5012;&#x5E8F;&#x64AD;&#x653E;
</code></pre>
<p>&#x76F8;&#x6BD4;ValueAnimator&#xFF0C;ObjectAnimator&#x76F4;&#x63A5;&#x63D0;&#x4F9B;&#x4E86;&#x8C03;&#x7528;&#x5C5E;&#x6027;set&#x65B9;&#x6CD5;&#x7684;&#x529F;&#x80FD;</p>
<p>ViewPropertyAnimator&#xFF1A;&#x8FD9;&#x4E2A;&#x662F;&#x5BF9;ObjectAnimator&#x7684;&#x5C01;&#x88C5;<br>&#x4E3A;&#x5565;&#x9700;&#x8981;&#x8FD9;&#x4E2A;&#xFF1F;&#x56E0;&#x4E3A;3.0&#x5F15;&#x5165;&#x7684;&#x5C5E;&#x6027;&#x52A8;&#x753B;&#x5DF2;&#x7ECF;&#x4E0D;&#x662F;&#x9488;&#x5BF9;View&#x8BBE;&#x8BA1;&#x7684;&#x4E86;&#xFF0C;&#x867D;&#x7136;&#x6211;&#x4EEC;&#x4E00;&#x822C;&#x4E5F;&#x5C31;&#x7528;&#x4E8E;View<br>&#x4F46;&#x5C31;&#x7B97;&#x7528;ObjectAnimator&#x8FD8;&#x662F;&#x7565;&#x663E;&#x590D;&#x6742;&#xFF0C;&#x6240;&#x4EE5;3.1&#x5F15;&#x5165;&#x4E86;&#x8FD9;&#x4E2A;ViewPropertyAnimator</p>
<pre><code class="lang-java">textview.animate().alpha(<span class="hljs-number">0f</span>);  
textview.animate().x(<span class="hljs-number">500</span>).y(<span class="hljs-number">500</span>);  
textview.animate().x(<span class="hljs-number">500</span>).y(<span class="hljs-number">500</span>).setDuration(<span class="hljs-number">5000</span>);  
textview.animate().x(<span class="hljs-number">500</span>).y(<span class="hljs-number">500</span>).setDuration(<span class="hljs-number">5000</span>).setInterpolator(<span class="hljs-keyword">new</span> BounceInterpolator());  


&#x4F7F;&#x7528;ViewPropertyAnimator&#x65F6;&#xFF0C;&#x6211;&#x4EEC;&#x81EA;&#x59CB;&#x81F3;&#x7EC8;&#x6CA1;&#x6709;&#x8C03;&#x7528;&#x8FC7;start()&#x65B9;&#x6CD5;&#xFF0C;&#x8FD9;&#x662F;&#x56E0;&#x4E3A;&#x65B0;&#x7684;&#x63A5;&#x53E3;&#x4E2D;&#x4F7F;&#x7528;&#x4E86;&#x9690;&#x5F0F;&#x542F;&#x52A8;&#x52A8;&#x753B;&#x7684;&#x529F;&#x80FD;&#xFF0C;
&#x53EA;&#x8981;&#x6211;&#x4EEC;&#x5C06;&#x52A8;&#x753B;&#x5B9A;&#x4E49;&#x5B8C;&#x6210;&#x4E4B;&#x540E;&#xFF0C;&#x52A8;&#x753B;&#x5C31;&#x4F1A;&#x81EA;&#x52A8;&#x542F;&#x52A8;&#x3002;&#x5E76;&#x4E14;&#x8FD9;&#x4E2A;&#x673A;&#x5236;&#x5BF9;&#x4E8E;&#x7EC4;&#x5408;&#x52A8;&#x753B;&#x4E5F;&#x540C;&#x6837;&#x6709;&#x6548;&#xFF0C;&#x53EA;&#x8981;&#x6211;&#x4EEC;&#x4E0D;&#x65AD;&#x5730;&#x8FDE;&#x7F00;&#x65B0;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;
&#x90A3;&#x4E48;&#x52A8;&#x753B;&#x5C31;&#x4E0D;&#x4F1A;&#x7ACB;&#x523B;&#x6267;&#x884C;&#xFF0C;&#x7B49;&#x5230;&#x6240;&#x6709;&#x5728;ViewPropertyAnimator&#x4E0A;&#x8BBE;&#x7F6E;&#x7684;&#x65B9;&#x6CD5;&#x90FD;&#x6267;&#x884C;&#x5B8C;&#x6BD5;&#x540E;&#xFF0C;&#x52A8;&#x753B;&#x5C31;&#x4F1A;&#x81EA;&#x52A8;&#x542F;&#x52A8;&#x3002;&#x5F53;&#x7136;&#x5982;&#x679C;
&#x4E0D;&#x60F3;&#x4F7F;&#x7528;&#x8FD9;&#x4E00;&#x9ED8;&#x8BA4;&#x673A;&#x5236;&#x7684;&#x8BDD;&#xFF0C;&#x6211;&#x4EEC;&#x4E5F;&#x53EF;&#x4EE5;&#x663E;&#x5F0F;&#x5730;&#x8C03;&#x7528;start()&#x65B9;&#x6CD5;&#x6765;&#x542F;&#x52A8;&#x52A8;&#x753B;
</code></pre>
<h3 id="62-path&#x52A8;&#x753B;">6.2 Path&#x52A8;&#x753B;</h3>
<p><a href="https://my.oschina.net/ososchina/blog/677307" target="_blank">https://my.oschina.net/ososchina/blog/677307</a>
<a href="http://m.2cto.com/kf/201503/380377.html" target="_blank">http://m.2cto.com/kf/201503/380377.html</a></p>
<p>&#x770B;&#x770B;&#x6548;&#x679C;&#x5427;&#x5148;&#xFF0C;Path&#x52A8;&#x753B;&#x5C31;&#x662F;&#x8BA9;&#x63A7;&#x4EF6;&#x8DDF;&#x7740;&#x4E00;&#x4E2A;Path&#x6307;&#x5B9A;&#x7684;&#x8DEF;&#x5F84;&#x8D70;<br><img src="img/anim_path.gif" alt=""></p>
<h2 id="7-material&#x52A8;&#x753B;">7 Material&#x52A8;&#x753B;</h2>
<p>&#x5B89;&#x5353;L&#x7684;Material&#x65B0;&#x589E;&#x4E86;&#x51E0;&#x79CD;&#x52A8;&#x753B;&#xFF1A;</p>
<ul>
<li>Touch feedback&#xFF08;&#x89E6;&#x6478;&#x53CD;&#x9988;&#xFF09;</li>
<li>Reveal effect&#xFF08;&#x63ED;&#x9732;&#x6548;&#x679C;&#xFF09;</li>
<li>Activity transitions&#xFF08;Activity&#x8F6C;&#x6362;&#x6548;&#x679C;&#xFF09;---&#x4E0B;&#x4E00;&#x8282;</li>
<li>Curved motion&#xFF08;&#x66F2;&#x7EBF;&#x8FD0;&#x52A8;&#xFF09;----&#x5C31;&#x662F;path&#x52A8;&#x753B;</li>
<li>View state changes &#xFF08;&#x89C6;&#x56FE;&#x72B6;&#x6001;&#x6539;&#x53D8;&#xFF09;</li>
<li>Animate Vector Drawables&#xFF08;&#x53EF;&#x7ED8;&#x77E2;&#x91CF;&#x52A8;&#x753B;&#xFF09;</li>
</ul>
<h3 id="71-touch-feedback">7.1 Touch feedback</h3>
<ul>
<li>&#x6700;&#x660E;&#x663E;&#xFF0C;&#x6700;&#x5177;&#x4EE3;&#x8868;&#x6027;&#x7684;&#x5C31;&#x662F;&#x6CE2;&#x7EB9;&#x52A8;&#x753B;</li>
<li>&#x4F7F;&#x7528;&#x4E86;Material&#x4E3B;&#x9898;&#x540E;&#xFF0C;&#x6CE2;&#x7EB9;&#x52A8;&#x753B;&#x4F1A;&#x81EA;&#x52A8;&#x5E94;&#x7528;&#x5728;&#x6240;&#x6709;&#x7684;&#x63A7;&#x4EF6;&#x4E0A;</li>
<li>&#x53EF;&#x4EE5;&#x6765;&#x8BBE;&#x7F6E;&#x5176;&#x5C5E;&#x6027;&#x6765;&#x8C03;&#x6574;&#x5230;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x7684;&#x6548;&#x679C;</li>
</ul>
<p>android:colorControlHighlight&#xFF1A;&#x8BBE;&#x7F6E;&#x6CE2;&#x7EB9;&#x989C;&#x8272;
android:colorAccent&#xFF1A;&#x8BBE;&#x7F6E;checkbox&#x7B49;&#x63A7;&#x4EF6;&#x7684;&#x9009;&#x4E2D;&#x989C;&#x8272;
colorAccent&#x8BBE;&#x7F6E;&#x5728;values/style.xml&#x4E0B;
android:colorControlHighlight&#x8BBE;&#x7F6E;&#x5728;values-21/style.xml&#x4E0B;</p>
<h3 id="72-reveal-effect">7.2 Reveal effect</h3>
<pre><code>btn2.setOnClickListener(new View.OnClickListener(){
    @Override
    public void onClick(View v) {

        if (android.os.Build.VERSION.SDK_INT &gt;= android.os.Build.VERSION_CODES.LOLLIPOP) {
            Animator animator = null;
            animator = ViewAnimationUtils.createCircularReveal(
                    btn2,
                    0,
                    0,
                    0,
                    (float) Math.hypot(btn2.getWidth(), btn2.getHeight()));
            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.setDuration(2000);
            animator.start();
        }else{
            Toaster.toastShort(&quot;&#x53EA;&#x652F;&#x6301;5.0&#x53CA;&#x5176;&#x4EE5;&#x4E0A;&#x7CFB;&#x7EDF;&quot;);
        }

    }
});
</code></pre><h3 id="73-curved-motion">7.3 Curved motion</h3>
<p>Path&#x52A8;&#x753B;</p>
<h3 id="74-view-state-changes">7.4 View state changes</h3>
<p>View&#x72B6;&#x6001;&#xFF0C;&#x548C;&#x4E4B;&#x524D;&#x8BBE;&#x7F6E;&#x7684;selector&#x662F;&#x4E00;&#x6837;&#x7684;&#xFF1A;</p>
<pre><code>android:state_activated      State value for StateListDrawable,
                             set when a view or its parent has been &quot;activated&quot;
                             meaning the user has currently marked it as being
                             of interest.
android:state_active         State value for StateListDrawable.
                             display a check mark.
android:state_checked        State identifier indicating that the object is
                             currently checked.
android:state_enabled        State value for StateListDrawable, set when a view is enabled.
android:state_first          State value for StateListDrawable.
android:state_focused        State value for StateListDrawable, set when a view has input focus.
android:state_last           State value for StateListDrawable.
android:state_middle         State value for StateListDrawable.
android:state_pressed        State value for StateListDrawable, set when the user is pressing down in a view.
android:state_selected       State value for StateListDrawable, set when a view (or one of its parents)
                             is currently selected.
android:state_single         State value for StateListDrawable.
android:state_window_focused
</code></pre><h4 id="1-&#x4F20;&#x7EDF;&#x7684;selector">1 &#x4F20;&#x7EDF;&#x7684;selector</h4>
<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; &gt;

    &lt;item android:state_pressed=&quot;true&quot;&gt;
        &lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
            android:shape=&quot;rectangle&quot; &gt;
            &lt;corners android:radius=&quot;3dp&quot;/&gt;
            &lt;solid android:color=&quot;@color/text_menu1_pressed&quot; /&gt;
        &lt;/shape&gt;

    &lt;/item&gt;

    &lt;item&gt;
        &lt;shape xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
            android:shape=&quot;rectangle&quot; &gt;
            &lt;corners android:radius=&quot;3dp&quot;/&gt;
            &lt;solid android:color=&quot;@color/text_menu1_normal&quot; /&gt;
        &lt;/shape&gt;

    &lt;/item&gt;

&lt;/selector&gt;
</code></pre><h4 id="2-statelistanimator">2 StateListAnimator</h4>
<p>&#x8FD9;&#x662F;&#x4E2A;&#x52A8;&#x753B;&#xFF0C;5.0&#x63D0;&#x4F9B;&#xFF0C;&#x53EF;&#x4EE5;&#x7528;&#x6765;&#x8BBE;&#x7F6E;&#x72B6;&#x6001;&#x6539;&#x53D8;&#x65F6;&#x7684;&#x52A8;&#x753B;</p>
<p>&#x653E;&#x5728;res/anim&#x91CC;</p>
<pre><code>sel_anim_1.xml

&lt;!-- animate the translationZ property of a view when pressed --&gt;
&lt;selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;&gt;
  &lt;item android:state_pressed=&quot;true&quot;&gt;
    &lt;set&gt;
      &lt;objectAnimator android:propertyName=&quot;translationZ&quot;
        android:duration=&quot;@android:integer/config_shortAnimTime&quot;
        android:valueTo=&quot;2dp&quot;
        android:valueType=&quot;floatType&quot;/&gt;
        &lt;!-- you could have other objectAnimator elements
             here for &quot;x&quot; and &quot;y&quot;, or other properties --&gt;
    &lt;/set&gt;
  &lt;/item&gt;
  &lt;item android:state_enabled=&quot;true&quot;
    android:state_pressed=&quot;false&quot;
    android:state_focused=&quot;true&quot;&gt;
    &lt;set&gt;
      &lt;objectAnimator android:propertyName=&quot;translationZ&quot;
        android:duration=&quot;100&quot;
        android:valueTo=&quot;0&quot;
        android:valueType=&quot;floatType&quot;/&gt;
    &lt;/set&gt;
  &lt;/item&gt;
&lt;/selector&gt;
</code></pre><p>&#x4EE3;&#x7801;&#x52A0;&#x8F7D;&#xFF1A;</p>
<pre><code>StateListAnimator stateLAnim = AnimatorInflater.loadStateListAnimator(this,R.anim.sel_anim_1);
tv_elevation.setStateListAnimator(stateLAnim);

&lt;Button
    android:id=&quot;@+id/btn2&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_margin=&quot;20dp&quot;
    android:layout_height=&quot;150dp&quot;
    android:colorControlHighlight=&quot;#ff0000&quot;
    android:colorAccent=&quot;#00ff00&quot;
    android:text=&quot;StateListAnimator&quot;
    android:background=&quot;@drawable/sel_menu3&quot;
    android:stateListAnimator=&quot;@anim/sel_anim_1&quot;
    /&gt;
</code></pre><p>&#x5982;&#x4F55;&#x5728;&#x4F4E;&#x7248;&#x672C;&#x5B9E;&#x73B0;&#x76F8;&#x5173;&#x7684;&#x8FD9;&#x79CD;&#x52A8;&#x753B;&#x5462;&#xFF1F;</p>
<p><a href="http://stackoverflow.com/questions/30545379/android-statelistanimator-in-pre-lollipop" target="_blank">http://stackoverflow.com/questions/30545379/android-statelistanimator-in-pre-lollipop</a>
&#x8FD9;&#x91CC;&#x7ED9;&#x51FA;&#x4E86;&#x7B54;&#x6848;</p>
<p>&#x4E5F;&#x5C31;&#x662F;&#x8FD9;&#x4E2A;&#x5E93;&#x5B9E;&#x73B0;&#x7684;&#x539F;&#x7406;: <a href="https://github.com/ZieIony/Carbon" target="_blank">https://github.com/ZieIony/Carbon</a></p>
<h4 id="3-animatedstatelistdrawable">3 AnimatedStateListDrawable</h4>
<p>&#x8FD9;&#x4E2A;&#x6548;&#x679C;&#x6709;&#x70B9;&#x610F;&#x601D;</p>
<ul>
<li>&#x5F53;&#x4F60;&#x662F;pressed&#x72B6;&#x6001;&#x7684;&#x65F6;&#x5019;animation-list&#x6B63;&#x7740;&#x8D70;&#x4E00;&#x904D;&#xFF0C;drawable&#x4F7F;&#x7528;&#x6700;&#x540E;&#x4E00;&#x4E2A;&#x3002;</li>
<li>&#x5F53;&#x4F60;&#x662F;default&#x72B6;&#x6001;&#x65F6;animation-list&#x53CD;&#x7740;&#x8D70;&#x4E00;&#x904D;&#xFF0C;drawable&#x4F7F;&#x7528;&#x7B2C;&#x4E00;&#x4E2A;&#x3002;</li>
</ul>
<p>&#x653E;&#x5728;drawable&#x91CC;</p>
<pre><code>sel_anim_drawable_1.xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;animated-selector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; &gt;

    &lt;!-- provide a different drawable for each state --&gt;
    &lt;item
        android:id=&quot;@+id/pressed&quot;
        android:drawable=&quot;@drawable/btn_pressed&quot;
        android:state_pressed=&quot;true&quot;/&gt;
    &lt;!-- &lt;item
        android:id=&quot;@+id/focused&quot;
        android:drawable=&quot;@drawable/btn_focused&quot;
        android:state_focused=&quot;true&quot;/&gt; --&gt;
    &lt;item
        android:id=&quot;@id/default1&quot;
        android:drawable=&quot;@drawable/btn_default&quot;/&gt;

    &lt;!-- specify a transition --&gt;
    &lt;transition
        android:fromId=&quot;@+id/default1&quot;
        android:toId=&quot;@+id/pressed&quot; &gt;
        &lt;animation-list&gt;
            &lt;item
                android:drawable=&quot;@drawable/con_time_tk&quot;
                android:duration=&quot;500&quot;/&gt;
            &lt;item
                android:drawable=&quot;@drawable/btn_default&quot;
                android:duration=&quot;500&quot;/&gt;
            &lt;item
                android:drawable=&quot;@drawable/btn_focused&quot;
                android:duration=&quot;500&quot;/&gt;
            &lt;item
                android:drawable=&quot;@drawable/btn_pressed&quot;
                android:duration=&quot;500&quot;/&gt;
            &lt;item
                android:drawable=&quot;@drawable/con_time_xm&quot;
                android:duration=&quot;500&quot;/&gt;
            &lt;item
                android:drawable=&quot;@drawable/con_time_tk&quot;
                android:duration=&quot;500&quot;/&gt;
        &lt;/animation-list&gt;
    &lt;/transition&gt;

&lt;/animated-selector&gt;
</code></pre><h3 id="75-animate-vector-drawables">7.5 Animate Vector Drawables</h3>
<p>&#x8FD9;&#x91CC;&#x6709;&#x4E2A;&#x8BDD;&#x9898;&#xFF1A;</p>
<ul>
<li>&#x7ED8;&#x5236;svg&#xFF1A;&#x9700;&#x8981;&#x501F;&#x52A9;&#x7B2C;&#x4E09;&#x65B9;&#xFF0C;&#x5C06;svg&#x8F6C;&#x6210;Path&#x5BF9;&#x8C61;&#xFF0C;&#x7136;&#x540E;drawPath&#xFF1A;<a href="http://blog.csdn.net/tianjian4592/article/details/44733123/" target="_blank">http://blog.csdn.net/tianjian4592/article/details/44733123/</a></li>
<li>svg&#x8F6C;&#x6210;VectorDrawable&#xFF1A;<a href="https://github.com/inloop/svg2android.git&#xFF0C;&#x4E00;&#x4E2A;js&#x641E;&#x5B9A;" target="_blank">https://github.com/inloop/svg2android.git&#xFF0C;&#x4E00;&#x4E2A;js&#x641E;&#x5B9A;</a></li>
<li>&#x600E;&#x4E48;&#x4F7F;&#x7528;vectorDrawable&#xFF1A;<a href="http://blog.csdn.net/cym492224103/article/details/41677825" target="_blank">http://blog.csdn.net/cym492224103/article/details/41677825</a></li>
</ul>
<p><a href="http://blog.csdn.net/tianjian4592/article/details/44733123/" target="_blank">http://blog.csdn.net/tianjian4592/article/details/44733123/</a>
<a href="http://blog.csdn.net/cym492224103/article/details/41677825" target="_blank">http://blog.csdn.net/cym492224103/article/details/41677825</a>
<a href="http://www.open-open.com/lib/view/open1416279313977.html" target="_blank">http://www.open-open.com/lib/view/open1416279313977.html</a>
svg2Path: <a href="http://blog.csdn.net/tianjian4592/article/details/44733123/" target="_blank">http://blog.csdn.net/tianjian4592/article/details/44733123/</a></p>
<p>&#x5173;&#x4E8E;&#xFF1A;vectorDrawables.useSupportLibrary = true<br><a href="http://blog.csdn.net/qq_15545283/article/details/51472458" target="_blank">http://blog.csdn.net/qq_15545283/article/details/51472458</a></p>
<p>VectorDrawable:
&#x5927;&#x4F53;&#x4E0A;&#x662F;&#x8FD9;&#x6837;&#xFF1A;</p>
<pre><code>&#x9996;&#x5148;&#x5728;drawable&#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x6709;vector&#x5B9A;&#x4E49;&#xFF0C;vector&#x548C;svg&#x53EF;&#x4EE5;&#x4E92;&#x76F8;&#x8F6C;&#x5316;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x8F6C;&#x5316;&#x6210;Path&#x5BF9;&#x8C61;&#x6765;drawPath

&lt;vector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
        android:height=&quot;64dp&quot;
        android:width=&quot;64dp&quot;
        android:viewportHeight=&quot;600&quot;
        android:viewportWidth=&quot;600&quot; &gt;
  &lt;group
      android:name=&quot;rotationGroup&quot;
      android:pivotX=&quot;300.0&quot;
      android:pivotY=&quot;300.0&quot;
      android:rotation=&quot;45.0&quot; &gt;
    &lt;path
        android:name=&quot;v&quot;
        android:fillColor=&quot;#000000&quot;
        android:pathData=&quot;M300,70 l 0,-70 70,70 0,0 -70,70z&quot; /&gt;
  &lt;/group&gt;
&lt;/vector&gt;

&#x8FD9;&#x4E2A;&#x662F;&#x4E00;&#x4E2A;&#x6BD4;&#x8F83;&#x7B80;&#x5355;&#x7684;&#x56FE;&#x5F62;&#xFF0C;&#x590D;&#x6742;&#x7684;svg&#x56FE;&#x6570;&#x636E;&#x5F88;&#x591A;
</code></pre><pre><code>&#x7136;&#x540E;&#x5B9A;&#x4E49;&#x5BF9;&#x8FD9;&#x4E2A;vector&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x77E2;&#x91CF;&#x56FE;&#x7684;&#x53D8;&#x6362;&#xFF1A;&#x5373;AnimatedVectorDrawable
&#x653E;&#x5728;drawable&#x76EE;&#x5F55;&#x4E0B;&#xFF1A;avd.xml
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;animated-vector xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
                 android:drawable=&quot;@drawable/vectordrawable&quot; &gt;
  &lt;target
      android:name=&quot;rotationGroup&quot;
      android:animation=&quot;@anim/rotation&quot; /&gt;
  &lt;target
      android:name=&quot;v&quot;
      android:animation=&quot;@anim/path_morph&quot; /&gt;
&lt;/animated-vector&gt;
</code></pre><pre><code>&#x4F7F;&#x7528;&#x8FD9;&#x4E2A;AnimatedVectorDrawable
 &lt;TextView
      android:layout_width=&quot;wrap_content&quot;
      android:layout_height=&quot;wrap_content&quot;
      android:layout_margin=&quot;@dimen/margin&quot;
      android:text=&quot;@string/example_from_documentation&quot;
      android:drawableBottom=&quot;@drawable/avd&quot;/&gt;
</code></pre><h2 id="8-transition">8 Transition</h2>
<p><a href="http://blog.jobbole.com/62601/" target="_blank">http://blog.jobbole.com/62601/</a>
<a href="http://www.open-open.com/lib/view/open1477879867267.html" target="_blank">http://www.open-open.com/lib/view/open1477879867267.html</a></p>
<p>Transiton&#x662F;&#x5728;5.0&#x4E4B;&#x540E;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;21&#xFF0C;&#x4E5F;&#x5C31;&#x662F;Build.VERSION_CODES.LOLLIPOP&#x5F15;&#x5165;&#x7684;<br>&#x4E4B;&#x524D;&#x7684;&#x7248;&#x672C;&#x53EA;&#x80FD;&#x7528;Activity&#x7684;overridePendingTransition()&#x548C;Fragment&#x7684;setCustomAnimation()&#x6765;&#x5B9E;&#x73B0;Activity&#x6216;&#x8005;Fragment&#x4E4B;&#x95F4;&#x7684;&#x52A8;&#x753B;&#x5207;&#x6362;  </p>
<ul>
<li><p>&#x5173;&#x4E8E;Activity&#x7684;overridePendingTransition()&#x548C;Fragment&#x7684;setCustomAnimation()</p>
<ul>
<li>&#x662F;&#x5C06;&#x6574;&#x4E2A;&#x9875;&#x9762;&#x4E00;&#x8D77;&#x52A8;&#x753B;&#x53D8;&#x6362;&#xFF0C;&#x6BD4;&#x8F83;&#x751F;&#x786C;</li>
<li>&#x4F46;&#x662F;&#x7528;&#x8D77;&#x6765;&#x6BD4;&#x8F83;&#x7B80;&#x5355;</li>
<li>&#x800C;&#x4E14;&#x52A8;&#x753B;&#x592A;&#x591A;&#xFF0C;Transition&#x54EA;&#x513F;&#x54EA;&#x513F;&#x90FD;&#x7279;&#x522B;&#x534E;&#x4E3D;&#xFF0C;&#x5E94;&#x7528;&#x53C8;&#x4F1A;&#x663E;&#x5F97;&#x534E;&#x800C;&#x4E0D;&#x5B9E;</li>
<li>&#x8FD9;&#x91CC;&#x9762;&#x6709;&#x4E2A;&#x5EA6;</li>
</ul>
</li>
<li><p>&#x5173;&#x4E8E;Transition</p>
<ul>
<li>&#x754C;&#x9762;A&#x6253;&#x5F00;&#x754C;&#x9762;B&#xFF0C;Transition&#x53EF;&#x4EE5;&#x8BA9;A&#x548C;B&#x4E4B;&#x95F4;&#x6709;&#x4E00;&#x5B9A;&#x7684;&#x5173;&#x8054;&#x6027;</li>
<li>&#x53EF;&#x80FD;&#x662F;A&#x548C;B&#x5171;&#x4EAB;&#x540C;&#x4E00;&#x4E2A;&#x5143;&#x7D20;</li>
<li>&#x6216;&#x8005;B&#x52A8;&#x753B;&#x5F00;&#x59CB;&#x7684;&#x4F4D;&#x7F6E;&#x662F;&#x57FA;&#x4E8E;&#x6211;&#x4EEC;&#x5728;A&#x4E2D;&#x8BBE;&#x7F6E;&#x7684;&#x503C;</li>
</ul>
</li>
</ul>
<h3 id="71-&#x4E3B;&#x9898;&#x8BBE;&#x7F6E;">7.1 &#x4E3B;&#x9898;&#x8BBE;&#x7F6E;</h3>
<p>&#x8981;&#x4F7F;&#x7528;Transition&#x8FDB;&#x884C;Activity&#x4E4B;&#x95F4;&#x7684;&#x52A8;&#x753B;&#x53D8;&#x6362;&#x65F6;&#xFF0C;&#x9996;&#x5148;&#x9700;&#x8981;&#x8BBE;&#x7F6E;&#xFF1A;</p>
<pre><code>//&#x8BBE;&#x7F6E;&#x5141;&#x8BB8;&#x901A;&#x8FC7;ActivityOptions.makeSceneTransitionAnimation&#x53D1;&#x9001;&#x6216;&#x8005;&#x63A5;&#x6536;Bundle
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
//&#x8BBE;&#x7F6E;&#x4F7F;&#x7528;TransitionManager&#x8FDB;&#x884C;&#x52A8;&#x753B;&#xFF0C;&#x4E0D;&#x8BBE;&#x7F6E;&#x7684;&#x8BDD;&#x7CFB;&#x7EDF;&#x4F1A;&#x4F7F;&#x7528;&#x4E00;&#x4E2A;&#x9ED8;&#x8BA4;&#x7684;TransitionManager
getWindow().requestFeature(Window.FEATURE_CONTENT_TRANSITIONS);
</code></pre><p>&#x4E5F;&#x53EF;&#x4EE5;&#x50CF;ApiDemo&#x91CC;&#x90A3;&#x6837;&#x8BBE;&#x7F6E;theme&#xFF1A;</p>
<pre><code>&lt;style name=&quot;ActivityTransitionTheme&quot; parent=&quot;android:Theme.Material&quot; tools:targetApi=&quot;lollipop&quot;&gt;
    &lt;item name=&quot;android:windowEnterTransition&quot;&gt;@transition/explode&lt;/item&gt;
    &lt;item name=&quot;android:windowExitTransition&quot;&gt;@transition/explode&lt;/item&gt;
    &lt;item name=&quot;android:windowSharedElementEnterTransition&quot;&gt;@transition/move_image&lt;/item&gt;
    &lt;item name=&quot;android:windowSharedElementExitTransition&quot;&gt;@transition/move_image&lt;/item&gt;
    &lt;item name=&quot;android:windowAllowReturnTransitionOverlap&quot;&gt;true&lt;/item&gt;
    &lt;item name=&quot;android:windowAllowEnterTransitionOverlap&quot;&gt;false&lt;/item&gt;
&lt;/style&gt;

&lt;activity android:name=&quot;.transition.ActivityTransition&quot;
    android:label=&quot;Animation/Activity Transition&quot;
    android:theme=&quot;@style/ActivityTransitionTheme&quot;&gt;
    &lt;intent-filter&gt;
        &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
        &lt;category android:name=&quot;android.intent.category.SAMPLE_CODE&quot; /&gt;
    &lt;/intent-filter&gt;
&lt;/activity&gt;
</code></pre><h3 id="72-&#x52A8;&#x753B;&#x8BBE;&#x7F6E;">7.2 &#x52A8;&#x753B;&#x8BBE;&#x7F6E;</h3>
<ul>
<li>Transition&#x6709;4&#x79CD;&#x53D8;&#x6362;&#xFF1A;&#x5982;&#x679C;&#x4ECE;A&#x6253;&#x5F00;B<ul>
<li>&#x9000;&#x51FA;(exit)   A.getWindow().setExitTransition(new Fade());</li>
<li>&#x8FDB;&#x5165;(enter)  B.getWindow().setEnterTransition(new Slide());</li>
<li>&#x8FD4;&#x56DE;(return) &#x6B64;&#x65F6;&#x518D;&#x4ECE;B&#x8FD4;&#x56DE;&#x5230;A&#xFF0C;B&#x6B64;&#x65F6;&#x53C8;&#x6709;&#x4E2A;&#x52A8;&#x753B;&#xFF0C;B.getWindow().setReturnTransition(new Fade());</li>
<li>&#x518D;&#x6B21;&#x8FDB;&#x5165;(reenter) &#x56DE;&#x5230;A&#x4E86;&#xFF0C;A&#x53C8;&#x6709;&#x4E2A;&#x52A8;&#x753B;&#xFF0C;A.getWindow().setReenterTransition(new Explode());</li>
</ul>
</li>
</ul>
<h3 id="73-&#x52A8;&#x753B;&#x6548;&#x679C;">7.3 &#x52A8;&#x753B;&#x6548;&#x679C;</h3>
<ul>
<li>&#x5305;&#x62EC;&#xFF1A;<ul>
<li>Fade(&#x6DE1;&#x51FA;)</li>
<li>Explode(&#x5206;&#x89E3;)</li>
<li>Slide(&#x6ED1;&#x52A8;)</li>
<li>&#x7CFB;&#x7EDF;&#x4F1A;&#x9ED8;&#x8BA4;&#x4E3A;&#x5176;&#x8BBE;&#x7F6E;Fade&#x52A8;&#x753B;&#x6548;&#x679C;</li>
</ul>
</li>
</ul>
<h3 id="74-&#x6253;&#x5F00;&#x754C;&#x9762;">7.4 &#x6253;&#x5F00;&#x754C;&#x9762;</h3>
<pre><code>//&#x4E0D;&#x4F20;&#x53C2;&#x6570;
Intent intent = new Intent(MainActivityA.this, MainActivityB.class);
ActivityOptions option = ActivityOptions.makeSceneTransitionAnimation(MainActivityA.this);
startActivity(intent, option.toBundle());

//&#x4F20;&#x53C2;&#x6570;
Intent intent = new Intent(this, ActivityTransitionDetails.class);
intent.putExtra(KEY_ID, v.getTransitionName());
ActivityOptions activityOptions = ActivityOptions.makeSceneTransitionAnimation(this, mHero, &quot;hero&quot;); //mHero&#x662F;ImageView
startActivity(intent, activityOptions.toBundle());
</code></pre><h3 id="75-&#x7B2C;&#x4E00;&#x79CD;&#x6548;&#x679C;&#xFF1A;&#x76F4;&#x63A5;transition">7.5 &#x7B2C;&#x4E00;&#x79CD;&#x6548;&#x679C;&#xFF1A;&#x76F4;&#x63A5;Transition</h3>
<p>&#x884C;&#x4E86;&#xFF0C;&#x5230;&#x8FD9;&#x7F57;&#x5217;&#x4E86;&#x4E0D;&#x5C11;&#x4E1C;&#x897F;&#x4E86;&#xFF0C;&#x8BE5;&#x770B;&#x770B;&#x6548;&#x679C;&#x4E86;  </p>
<pre><code>&#x754C;&#x9762;1&#xFF1A;
getWindow().setExitTransition(new Fade());
getWindow().setReenterTransition(new Explode());
getWindow().setEnterTransition(new Slide());
getWindow().setReturnTransition(new Fade());


&#x754C;&#x9762;2&#xFF1A;
getWindow().setExitTransition(new Fade());
getWindow().setReenterTransition(new Explode());
getWindow().setEnterTransition(new Slide());
getWindow().setReturnTransition(new Fade());
</code></pre><p>&#x4E0A;&#x56FE;&#xFF1A;<br><img src="img/transition1.gif" alt=""></p>
<p>&#x5DEE;&#x4E0D;&#x591A;&#x80FD;&#x770B;&#x51FA;&#x6765;&#xFF0C;Transition&#x6846;&#x67B6;&#x4F1A;&#x628A;&#x5E03;&#x5C40;&#x5207;&#x5272;&#x6210;&#x5355;&#x72EC;&#x7684;&#x90E8;&#x5206;&#xFF0C;&#x7136;&#x540E;&#x5BF9;&#x6BCF;&#x4E00;&#x4E2A;&#x90E8;&#x5206;&#x5E94;&#x7528;Fade&#xFF0C;Explode&#xFF0C;Slide&#x6548;&#x679C;  </p>
<ul>
<li>&#x5927;&#x4F53;&#x662F;&#x600E;&#x4E48;&#x5207;&#x5272;&#x51FA;&#x5355;&#x72EC;&#x90E8;&#x5206;&#x7684;&#x5462;&#xFF1F;<ul>
<li>&#x5E94;&#x8BE5;&#x662F;&#x4ECE;DecoreView&#x5F00;&#x59CB;&#x7684;</li>
<li>&#x53EA;&#x8981;&#x6709;ViewGroup&#x5305;&#x7684;&#xFF0C;&#x5C31;&#x5F80;&#x4E0B;&#x5207;&#x5272;</li>
<li>&#x76F4;&#x5230;&#x5207;&#x5272;&#x5230;&#x4E00;&#x4E2A;ViewGroup&#x4E0B;&#x9762;&#x4E0D;&#x4F1A;&#x518D;&#x6709;ViewGroup&#xFF0C;&#x8FD9;&#x4E00;&#x7EC4;&#x5C31;&#x4F1A;&#x6210;&#x4E3A;&#x4E00;&#x4E2A;&#x5355;&#x72EC;&#x7684;&#x90E8;&#x5206;</li>
<li>&#x548C;ViewGroup&#x5E73;&#x7EA7;&#x7684;&#x4E5F;&#x53EF;&#x80FD;&#x662F;&#x4E00;&#x4E2A;View&#xFF0C;&#x8FD9;&#x4E2A;View&#x4E5F;&#x4F1A;&#x6210;&#x4E3A;&#x4E00;&#x4E2A;&#x5355;&#x72EC;&#x7684;&#x90E8;&#x5206;</li>
<li>&#x4F8B;&#x5982;LinearLayout&#x5305;&#x542B;RelativeLayout&#x548C;&#x4E00;&#x4E2A;ImageView&#xFF0C;RelativeLayout&#x4E0B;&#x53EA;&#x6709;View</li>
<li>&#x8FD9;&#x4E2A;RelativeLayout&#x548C;ImageView&#x4F1A;&#x88AB;&#x5207;&#x5272;&#x6210;&#x4E24;&#x4E2A;&#x5355;&#x72EC;&#x7684;&#x90E8;&#x5206;</li>
</ul>
</li>
</ul>
<h3 id="76-&#x7B2C;&#x4E8C;&#x79CD;&#x6548;&#x679C;&#xFF1A;&#x5171;&#x4EAB;&#x5143;&#x7D20;&#x53D8;&#x6362;">7.6 &#x7B2C;&#x4E8C;&#x79CD;&#x6548;&#x679C;&#xFF1A;&#x5171;&#x4EAB;&#x5143;&#x7D20;&#x53D8;&#x6362;</h3>
<p>&#x754C;&#x9762;A&#x6253;&#x5F00;&#x754C;&#x9762;B&#xFF0C;A&#x4E2D;&#x7684;&#x4E00;&#x4E2A;ImageView&#x4F1A;&#x5728;B&#x4E2D;&#x653E;&#x5927;&#x663E;&#x793A;&#xFF0C;&#x8FD9;&#x5C31;&#x662F;ApiDemo&#x91CC;&#x63D0;&#x4F9B;&#x7684;&#x4F8B;&#x5B50;  </p>
<p>&#x8FD9;&#x4E2A;&#x6548;&#x679C;&#x8DDF;&#x4E0A;&#x9762;&#x7684;Slide&#xFF0C;Fade&#xFF0C;Explode&#x662F;&#x4E0D;&#x51B2;&#x7A81;&#x7684;&#xFF0C;&#x633A;&#x597D;</p>
<p>&#x7B2C;&#x4E00;&#x6B65;&#xFF1A;<br>&#x5728;A&#x548C;B&#x7684;&#x5E03;&#x5C40;&#x6587;&#x4EF6;&#x4E2D;&#xFF0C;&#x7ED9;&#x4E24;&#x4E2A;ImageView&#x7684;transitionName&#x5C5E;&#x6027;&#x8BBE;&#x7F6E;&#x6210;&#x4E00;&#x6837;&#x7684;&#x503C;&#xFF0C;&#x8FD9;&#x662F;&#x5FC5;&#x987B;&#x7684;<br>android:transitionName=&quot;ducky&quot;</p>
<p>&#x7B2C;&#x4E8C;&#x6B65;&#xFF1A;<br>&#x6253;&#x5F00;&#x754C;&#x9762;&#x65F6;&#xFF0C;&#x5728;ActivityOptions.makeSceneTransitionAnimation&#x4E2D;&#x5C06;&#x9700;&#x8981;&#x5171;&#x4EAB;&#x7684;&#x5143;&#x7D20;&#x4F5C;&#x4E3A;&#x53C2;&#x6570;&#x4F20;&#x9012;&#x8FC7;&#x53BB;</p>
<pre><code>Intent intent = new Intent(MainActivityA.this, MainActivityB.class);
ActivityOptions option = ActivityOptions.makeSceneTransitionAnimation(MainActivityA.this,imageView,&quot;ducky&quot;);
startActivity(intent, option.toBundle());

ActivityOptions.makeSceneTransitionAnimation(MainActivityA.this,imageView,&quot;ducky&quot;);
&#x8FD9;&#x91CC;&#x7684;&#x53C2;&#x6570;2&#x548C;3&#x8868;&#x793A;&#xFF1A;transitionName&#x503C;&#x4E3A;ducky&#x7684;&#x63A7;&#x4EF6;&#x9700;&#x8981;&#x5171;&#x4EAB;&#xFF0C;&#x5728;A&#x4E2D;&#x5C31;&#x662F;imageView&#xFF0C;&#x5728;B&#x4E2D;&#x4F60;&#x4E5F;&#x80FD;&#x6839;&#x636E;transitionName&#x627E;&#x5230;

//&#x591A;&#x4E2A;&#x5143;&#x7D20;&#x5171;&#x4EAB;&#xFF1A;
ActivityOptions option = ActivityOptions.makeSceneTransitionAnimation(MainActivityA.this,
            Pair.create(imageView, &quot;share_image&quot;),
            Pair.create(button, &quot;share_button&quot;));
</code></pre><p>&#x6548;&#x679C;&#x5C31;&#x662F;&#xFF1A;A&#x4E2D;&#x7684;ImageView&#x4F1A;&#x4ECE;&#x81EA;&#x5DF1;&#x7684;&#x4F4D;&#x7F6E;&#x548C;&#x5927;&#x5C0F;&#xFF0C;&#x901A;&#x8FC7;&#x5E73;&#x79FB;&#x548C;&#x7F29;&#x653E;&#x5B9A;&#x4F4D;&#x5230;B&#x4E2D;&#x5BF9;&#x5E94;&#x7684;&#x4F4D;&#x7F6E;</p>
<p>&#x770B;&#x56FE;&#xFF1A;<br><img src="img/transition2.gif" alt=""></p>
<h2 id="9-setlayoutanimation&#xFF1A;&#x5E03;&#x5C40;&#x52A8;&#x753B;">9 setLayoutAnimation&#xFF1A;&#x5E03;&#x5C40;&#x52A8;&#x753B;</h2>
<p>&#x4E00;&#x770B;&#x662F;Animation,&#x5C31;&#x77E5;&#x9053;&#x662F;tween&#x52A8;&#x753B;</p>
<pre><code>Animation a = getLayoutAnimation();
a.setDuration(1000);
LayoutAnimationController lc = new LayoutAnimationController(a);
wrapper.setLayoutAnimation(lc);
</code></pre><p>&#x53EA;&#x80FD;&#x63A7;&#x5236;addView&#xFF0C;&#x7BA1;&#x4E0D;&#x4E86;removeView&#xFF0C;&#x4E5F;&#x7BA1;&#x4E0D;&#x4E86;visibility&#x53D8;&#x5316;&#xFF0C;&#x4E5F;&#x7BA1;&#x4E0D;&#x4E86;&#x5B50;&#x63A7;&#x4EF6;&#x5E03;&#x5C40;&#x4F4D;&#x7F6E;&#x53D8;&#x5316;</p>
<p>&#x80FD;&#x7528;&#x4E8E;&#x6240;&#x6709;&#x7C7B;&#x578B;&#x7684;ViewGroup</p>
<h2 id="10-transition&#x6846;&#x67B6;">10 Transition&#x6846;&#x67B6;</h2>
<p>&#x81EA;Android 4.4&#xFF08;KitKat&#xFF09;&#x8D77;&#xFF0C;Android&#x52A0;&#x5165;&#x4E86;Android Transition&#x6846;&#x67B6;&#xFF0C;
&#x672C;&#x4F8B;&#x4F7F;&#x7528;&#x4E86;&#x4E00;&#x4E9B;5.0&#x52A0;&#x5165;&#x7684;API&#xFF0C;SDK&#x7248;&#x672C;&#x8BF7;&#x4F7F;&#x7528;21</p>
<p><a href="http://blog.jobbole.com/62601/" target="_blank">http://blog.jobbole.com/62601/</a></p>
<p><a href="http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0322/2631.html" target="_blank">http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0322/2631.html</a></p>
<p><a href="http://jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0113/2310.html" target="_blank">http://jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0113/2310.html</a></p>
<h2 id="9-layouttransition&#xFF1A;&#x5E03;&#x5C40;&#x52A8;&#x753B;">9 LayoutTransition&#xFF1A;&#x5E03;&#x5C40;&#x52A8;&#x753B;</h2>
<p>4.0&#x5F15;&#x5165;&#xFF0C;&#x8FD9;&#x4E2A;&#x4E0D;&#x7528;&#x8003;&#x8651;&#x517C;&#x5BB9;&#x95EE;&#x9898;&#x4E86;&#xFF0C;&#x90FD;&#x80FD;&#x7528;</p>
<p>&#x4F7F;&#x7528;&#xFF1A;</p>
<ul>
<li>&#x5728;ViewGroup&#x7684;&#x5E03;&#x5C40;&#x4E2D;&#x6307;&#x5B9A;&#xFF1A;android:animateLayoutChanges=&quot;true&quot;&#xFF0C;&#x53EF;&#x4EE5;&#x6FC0;&#x6D3B;&#x9ED8;&#x8BA4;&#x52A8;&#x753B;</li>
<li>&#x4E5F;&#x53EF;&#x4EE5;&#x5728;&#x5982;&#x4E0B;&#x4EE3;&#x7801;&#x8BBE;&#x7F6E;&#xFF1A;<pre><code>ViewGroup  container = (ViewGroup) findViewById(R.id.container);
LayoutTransition transition = new LayoutTransition();
container.setLayoutTransition(transition);
</code></pre></li>
</ul>
<p>&#x6FC0;&#x6D3B;&#x65F6;&#x673A;&#xFF1A;</p>
<ul>
<li>addView</li>
<li>removeView</li>
<li>childView&#x7684;Visibility&#x53D8;&#x5316;</li>
<li>childView&#x5728;&#x7236;&#x5E03;&#x5C40;&#x4F4D;&#x7F6E;&#x7684;&#x53D8;&#x5316;</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="canvas-paint.html" class="navigation navigation-prev " aria-label="Previous page: draw和canvas，paint详解">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="notify.html" class="navigation navigation-next " aria-label="Next page: notify系列库">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"动画","level":"1.4","depth":1,"next":{"title":"notify系列库","level":"1.5","depth":1,"path":"notify.md","ref":"notify.md","articles":[]},"previous":{"title":"draw和canvas，paint详解","level":"1.3","depth":1,"path":"canvas-paint.md","ref":"canvas-paint.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"anim.md","mtime":"2017-04-09T10:56:41.074Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-04-09T17:03:25.521Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

